Then import the resulting project package into Android Studio. will prompt the error, we need to the project root directory in the Build.gradle file (possibly your Android studio use of the Gradle version and Gradle version of the plugin is different from mine, it is recommended to change to their own version of the use):
Note: If possible, you may also need to change the/gradle/wrapper/gradle-wrapper.properties in the project root directory
Workaround: Change the Gradle plug-in version of the Build.gradle in the DEMO-SRC directory to the version you use for Android Studio (I'm using 1.5.0):
Java
dependencies {
Classpath ' com.android.tools.build:gradle:1.5.0 '
}
123 Dependencies {classpath ' com.android.tools.build:gradle:1.5.0 '}
Change the Gradle version in Demo-src/gradle/wrapper/gradle-wrapper.properties to the version that Android Studio uses (I'm using the latest Gradle version, 2.8):
Java
Distributionurl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
1 Distributionurl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Then "Sync Now" won't report the mistake.
Error B:
This error is caused by the laziness of Sina Weibo SDK developers, and the cause of the error is in the picture, so I'm going to classify it as a mistake here.
The error is as follows:
Error:execution failed for task ': Weibosdkdemo:mergedebugresources '.
> Crunching cruncher ic_login_button_blue_normal.9.png failed, logs
In fact, looking at compilation errors, or to see the Gradle console errors and warnings, as follows:
AAPT err (façade for 1170324693): Error:9-patch image C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\ Weibosdkdemo\res\drawable\ic_login_button_blue_normal.9.png Malformed.
AAPT err (façade for 1170324693): Frame pixels must is either solid or transparent (not intermediate).
AAPT err (façade for 1170324693): Found in pixel #2 along top edge.
AAPT err (façade for 1170324693): Error:9-patch image C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\ Weibosdkdemo\res\drawable\ic_login_button_blue_focused.9.png Malformed.
AAPT err (façade for 1170324693): Frame pixels must is either solid or transparent (not intermediate).
AAPT err (façade for 1170324693): Found in pixel #2 along top edge.
AAPT err (façade for 576922613): libpng error:not a PNG file
AAPT err (façade for 735358242): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-mdpi-v4\ic_com_sina_weibo_sdk_login_with _text.png:libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
AAPT err (façade for 576922613): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-hdpi-v4\ic_com_sina_weibo_sdk_logo.png: Libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
AAPT err (façade for 735358242): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-ldpi-v4\ic_com_sina_weibo_sdk_logo.png: Libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
AAPT err (façade for 576922613): Error:9-patch image C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\ Weibosdkdemo\res\drawable\ic_login_button_blue_pressed.9.png Malformed.
AAPT err (façade for 706899532): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-xhdpi-v4\ic_com_sina_weibo_sdk_logo.png: Libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
AAPT err (façade for 576922613): No marked region found edge.
AAPT err (façade for 576922613): Found along top edge.
AAPT err (façade for 1615154168): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-ldpi-v4\ic_com_sina_weibo_sdk_login_with _text.png:libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
AAPT err (façade for 1561367387): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-mdpi-v4\ic_com_sina_weibo_sdk_logo.png: Libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
AAPT err (façade for 1561367387): C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\WeiboSDKDemo\build\ Intermediates\exploded-aar\demo-src\weibosdk\unspecified\res\drawable-hdpi-v4\ic_com_sina_weibo_sdk_login_with _text.png:libpng Warning:iCCP:Not Recognizing known SRGB profile that has been edited
There are two main errors (I ignore the warning message here because the warning does not cause the compilation to fail). The warning message is also because there are problems with PNG pictures, you can Google the reasons and solutions. ):
1.AAPT err (façade for 1170324693): Error:9-patch image C:\Users\AlexY\Desktop\weibo_android_sdk-master\demo-src\ Weibosdkdemo\res\drawable\ic_login_button_blue_normal.9.png Malformed.
AAPT err (façade for 1170324693): Frame pixels must is either solid or transparent (not intermediate).
AAPT err (façade for 1170324693): Found in pixel #2 along top edge.
Reason: The report this mistake, is because the picture in the Weibosdkdemo is in fact not the point 9 picture, only is changed the suffix name. As I said earlier, Gradle compilation requires a higher, so it will not fail to compile in eclipse because of this error, but Android Studio will cause failure.
WORKAROUND: Will so hint not to point 9 picture file, use Android Studio's Point 9 picture editor, fix it to point 9 pictures.
2.AAPT err (façade for 576922613): libpng error:not a PNG file
Reason: This error is because the picture in the Weibosdkdemo is not a PNG format picture, but a JPG image, but is the developer of Sina directly changed to ". png" suffix name, so, Android Studio compilation does not pass.
Workaround: Find a picture that is not in PNG format, and Windows does not seem to have the tool, even if you right-click on the file properties. So, with the help of Android Studio's picture editor, open all the. png files in turn with Android studio, and finally discover:/demo-src/weibosdkdemo/res/drawable/ic_share_ Music_thumb.png is not in PNG format, but JPG.
You can then convert it to a PNG picture.
Unexpected top-level EXCEPTION:
Com.android.dex.DexException:Multiple dex Files Define landroid/support/v4/accessibilityservice/ Accessibilityserviceinfocompat$accessibilityserviceinfoversionimpl;
At Com.android.dx.merge.DexMerger.readSortableTypes (dexmerger.java:579)
At Com.android.dx.merge.DexMerger.getSortedTypes (dexmerger.java:535)
At Com.android.dx.merge.DexMerger.mergeClassDefs (dexmerger.java:517)
At Com.android.dx.merge.DexMerger.mergeDexes (dexmerger.java:164)
At Com.android.dx.merge.DexMerger.merge (dexmerger.java:188)
At Com.android.dx.command.dexer.Main.mergeLibraryDexBuffers (main.java:504)
At Com.android.dx.command.dexer.Main.runMonoDex (main.java:334)
At Com.android.dx.command.dexer.Main.run (main.java:277)
At Com.android.dx.command.dexer.Main.main (main.java:245)
At Com.android.dx.command.Main.main (main.java:106)
reason: because the Weibosdkdemo/build.gradle file has been added two times weibosdk dependencies, as follows:
dependencies {
Compile Filetree (dir: ' Libs ', include: ' *.jar ')
Compile project (': Weibosdk ')
Compile project (': Weibosdk ')
}
And Weibosdk/libs under the Support-v4.jar, so that prompted SUPPORT-V4 package multiple import, resulting in the compilation failed.
WORKAROUND: Delete the duplicate row, which is called the following:
dependencies {
Compile Filetree (dir: ' Libs ', include: ' *.jar ')
Compile project (': Weibosdk ')
}
Then "Sync Now" and recompile, it will not report this error.