2016-08-30 4 views
0

У меня есть приложение для Android. Я могу запустить его на своем устройстве без проблем, но когда я пытаюсь создать файл apk, я получаю следующие ошибки.Получение ошибок только при создании .apk

Error:warning: Ignoring InnerClasses attribute for an anonymous innerclass 
Error:(org.joda.time.DateTimeZone$1) that doesn't come with an 
Error:associated EnclosingMethod attribute. This class was probably produced by a 
Error:compiler that did not target the modern .class file format. The recommended 
Error:solution is to recompile the class from source, using an up-to- date compiler 
Error:and without specifying any "-target" type options. The consequence of ignoring 
Error:this warning is that reflective operations on this class will incorrectly 
Error:indicate that it is *not* an inner class. 
Error:The number of method references in a .dex file cannot exceed 64K. 
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html 
:app:transformClassesWithDexForDebug FAILED 
Error:Execution failed for task  ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 

Вот моя зависимость:

dependencies { 
compile 'com.google.android.gms:play-services:+' 
compile 'com.google.code.gson:gson:2.1' 
compile 'com.google.guava:guava:11.0.1' 
compile 'com.google.protobuf:protobuf-java:2.2.0' 
compile files('libs/acra-4.5.0.jar') 
compile files('libs/google-api-client-1.10.3-beta.jar') 
compile files('libs/google-api-client-android2-1.10.3-beta.jar') 
compile files('libs/google-http-client-1.10.3-beta.jar') 
compile files('libs/google-http-client-android2-1.10.3-beta.jar') 
compile files('libs/google-oauth-client-1.10.1-beta.jar') 
compile files('libs/jackson-core-asl-1.9.4.jar') 
compile files('libs/jsr305-1.3.9.jar') 
compile files('/Users/emredurmus/Documents/Projects/CrmMobile1/Libs/odata4j-0.7.0-clientbundle.jar') 
compile 'com.google.android.gms:play-services:+'} 

Что я должен делать?

Благодаря

+0

Вы пробовали очистить и перестроить проект? Я также получал такую ​​же ошибку раньше. Я сделал то же самое. Это сработало для меня –

+0

Да, да. Он также отлично работает на моем реальном устройстве. Проблема в том, что я пытаюсь создать apk. – user2858924

ответ

1

добавить следующие строки в моем proguard-rules.pro файл:

-keepattributes InnerClasses,EnclosingMethod 
-dontoptimize 
+0

Я сделал. Я получаю те же ошибки. – user2858924

1

Это ваша реальная проблема:

Error:The number of method references in a .dex file cannot exceed 64K.

Это ваше решение:

Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

0

Вы превысили лимит 64к метод.

Замените compile 'com.google.android.gms:play-services:+'} только теми службами GMS, которые вам нужны.

Вы можете включить только избранные API-интерфейсы из необходимых игровых сервисов Google. Получить точные имена, чтобы добавить здесь - official documentation

Смежные вопросы