#android
Пытаюсь собрать release версию приложения и получить apk. в ответ получаю сообщение
Generate Signed APK
Errors while building APK. You can find the errors in the 'Messages' view.
в логах пишет вот такое
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
Job failed, see logs for details
ну и ссылается на библиотеки для работы с сетью
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program
class org.apache.http.params.HttpParams
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program
class org.apache.http.protocol.HttpRequestExecutor
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program
class org.apache.http.protocol.HttpContext
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program
class org.apache.http.ConnectionReuseStrategy
Warning:library class org.apache.http.impl.client.DefaultHttpClient depends on program
class org.apache.http.protocol.BasicHttpProcessor
Warning:there were 74 unresolved references to classes or interfaces.
Warning:there were 127 instances of library classes depending on program classes.
Warning:Exception while processing task java.io.IOException: Please correct the above
warnings first.
Event Log
13:43:52 Gradle build finished with 1 error(s) and 169 warning(s) in 13s 295ms
13:43:52 Build APK: Errors while building APK. You can find the errors in the 'Messages'
view.
Ответы
Ответ 1
У вас включен proguard для релизной сборки. Скорее всего у вас в некорректно настроен файл proguard.pro. Вот тут про proguard Вот тут коллекция правил под разные популярные библиотеки В вашем случае, возможно, поможет такой набор: -dontwarn org.apache.commons.** -keep class org.apache.http.** { *; } -dontwarn org.apache.http.**Ответ 2
release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.config } В фале build.gradle изменил minifyEnabled true на minifyEnabled false и получилось.
Комментариев нет:
Отправить комментарий