当我开始针对Android的API 23,gradle插件1.3.1,gradle 2.7构建时,我无法再生成APK。也许是ProGuard的东西,但我不明白它是什么。我在stackoverflow上看了很多类似的问题,但找不到解决方案。
Error:Execution failed for task ':MyApp:packageDebug'.
> Unable to compute hash of D:\Android\Projects\xxx\xxx\build\intermediates\classes-proguard\debug\classes.jar
我也有警告我不明白他们的意思。这些是:
Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
和
Warning:com.google.api.client.testing.http.apache.MockHttpClient$1: can't find referenced class org.apache.http.HttpRequest
Warning:com.google.api.client.testing.http.apache.MockHttpClient$1: can't find referenced class org.apache.http.protocol.HttpContext
Warning:there were 166 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 3 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
我认为这些库使用httpclient
compile ('com.google.apis:google-api-services-drive:v2-rev186-1.20.0')
compile ('com.google.api-client:google-api-client:1.20.0')
compile ('com.google.api-client:google-api-client-android:1.20.0')
compile ('com.google.api-client:google-api-client-gson:1.20.0')
compile ('com.google.oauth-client:google-oauth-client:1.20.0')
compile ('com.google.code.gson:gson:2.3.1')
compile ('com.google.http-client:google-http-client:1.20.0')
compile ('com.google.http-client:google-http-client-android:1.20.0')
compile ('com.google.http-client:google-http-client-gson:1.20.0')
我试图添加
{
exclude module: 'httpclient' //by artifact name
exclude group: 'org.apache.httpcomponents' //by group
exclude group: 'org.apache.httpcomponents', module: 'httpclient' //by both name and group
}
以及
useLibrary 'org.apache.http.legacy'
和
-dontwarn org.apache.http.**
-dontwarn org.apache.lang.**
-dontwarn android.net.http.AndroidHttpClient
但我无法编译。 请帮忙! :/
感谢您的任何想法!