I'm trying to generate a signed apk and the log keeps showing me the following error:
:app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:collectReleaseMultiDexComponents
:app:proguardRelease
Warning:com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient
Warning:com.google.android.gms.internal.zzw: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.google.android.gms.internal.zzw$zza
Warning:com.google.android.gms.internal.zzw$zza: can't find referenced method 'void setURI(java.net.URI)' in program class com.google.android.gms.internal.zzw$zza
Warning:com.ironsource.mobilcore.j: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning:com.mopub.volley.toolbox.HttpClientStack: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.mopub.volley.toolbox.HttpClientStack$HttpPatch
Warning:com.mopub.volley.toolbox.HttpClientStack$HttpPatch: can't find referenced method 'void setURI(java.net.URI)' in program class com.mopub.volley.toolbox.HttpClientStack$HttpPatch
Warning:com.mopub.volley.toolbox.Volley: can't find referenced class android.net.http.AndroidHttpClient
Warning:there were 4 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 4 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)
Warning:there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
:app:shrinkReleaseMultiDexComponents FAILED
Error:Execution failed for task ':app:shrinkReleaseMultiDexComponents'.
> java.io.IOException: The output jar [<project_path>\app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.
Below is my app-level build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 14
targetSdkVersion 23
versionCode 25
versionName "2.5"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "2048M"
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
compile 'me.dm7.barcodescanner:zxing:1.7.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.scottyab:secure-preferences-lib:0.1.3'
compile 'com.soundcloud.android:android-crop:1.0.0@aar'
compile('com.afollestad.material-dialogs:core:0.8.1.0@aar') {
transitive = true
}
compile('com.mopub:mopub-sdk:3.13.0@aar') {
transitive = true
}
compile project(':android-support-v4-preferencefragment')
compile project(':circular_progress_bar')
compile files('libs/mobilecore_V1.1.jar')
compile files('libs/libAdapterSDKMoPub.jar')
compile files('libs/adcolony.jar')
}
And my top-level build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I have tried with other version of gradle like 1.4.0-beta1', 1.4.0-beta2
, and 1.3.1
still no luck.
this is a very easy problem to solve. the problem rises when you are developing an app and somewhere in the middle you update your SDK. this is fine but you what you don't know the gradle configuration for you project should be up to date. so simply create a new project and look at your
classpath
which for mine wascom.android.tools.build:gradle:1.3.1
in the project but now new projects class path areclasspath 'com.android.tools.build:gradle:1.5.0'
. the other thing to consider iscompileSdkVersion
,buildToolsVersion
,targetSdkVersion
. you should also check if your libraries version are up to date. you can find their versions by simply opening you SDK-manager. so to wrap it up: this is what your project gradle should be updated:and this is the sections in gradle module level file that should be updated:
hope this helps
There is some info right there in your trace --
At least part of your problem is that
AndroidHttpClient
was removed in API 23, and at least one of your libraries depends on it. You have three options.1) You can include the following in your
build.gradle
file. Which includes the legacy library in your apk. See Apache HTTP Client Removal.2) You can lower your target and compile sdk to 22 instead of 23. That should allow you to compile, or at least resolve the
AndroidHttpClient
issue until the libraries are updated to not require it.3) You can add
-dontwarn
commands to your proguard file to suppress the warns to get a build. As noted in the documentation, this can be dangerous if you aren't certain the warnings can be safely ignored. I am not certain if ignoring warnings stemming from the removal ofHttpClient
and associated classes is safe or not. It might lead to an unstable build when running on M, but should be safe for L and below because those classes exist on devices at that API level.ADDED: For whoever struggles the same, keep in mind that you'll have to lower your
builToolsVersion
andcom.android.support
in the dependency to22.0.1
.