I am updating the application from 2.3 to Nougat (SDK 25). When I add com.android.support:appcompat-v7:25.0.0 to support ActivityCompat.requestPermissions . When I run this in debug mode, the application works without problems, but working with ./gradlew assembleDebug causes the following error:
Error:Execution failed for task ':transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/hardware/display/DisplayManagerCompat.class
When I run this in debug mode, the application builds without problems, however, when I try the Build APK , I get the error above.
Is there a way to track duplicate package? I ran the following:
./gradlew -q dependencies :dependencies --configuration compile ------------------------------------------------------------ Root project ------------------------------------------------------------ compile - Classpath for compiling the main sources. +--- com.android.support:multidex:1.0.1 +--- com.android.support:appcompat-v7:25.0.0 | +--- com.android.support:support-vector-drawable:25.0.0 | | \--- com.android.support:support-compat:25.0.0 | | \--- com.android.support:support-annotations:25.0.0 | \--- com.android.support:animated-vector-drawable:25.0.0 | \--- com.android.support:support-vector-drawable:25.0.0 (*) +--- project :deps:android-map-utils:library | \--- project :deps:google-maps-m4b \--- project :deps:google-play-services (*) - dependencies omitted (listed previously)
Here is my 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:2.2.2' } } apply plugin: 'com.android.application' dependencies { compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:appcompat-v7:25.0.0' compile fileTree(include: '*.jar', dir: 'libs') compile fileTree(include: '*.jar', dir: 'lib') compile project(':deps:google-maps-m4b') compile project(':deps:android-map-utils:library') compile project(':deps:google-play-services') } android { compileSdkVersion 24 buildToolsVersion '25.0.0' packagingOptions { exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/LICENSE' exclude 'META-INF/license.txt' exclude 'META-INF/LGPL2.1' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/notice.txt' } defaultConfig { // Already hit dex limit multiDexEnabled true dexOptions { javaMaxHeapSize "4g" } } lintOptions { abortOnError false } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/<type> // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/<type>/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } } allprojects { repositories { jcenter() } }
Files in libs : armeabi/libcryptowrapper.so Files in lib :
ClientCertUtil.jar apache-mime4j-0.6.jar commons-codec-1.6.jar commons-io-2.4.jar commons-logging-1.1.3.jar gcm.jar httpclient-4.3.4.jar httpclientandroidlib-1.2.1.jar httpcore-4.3.jar httpmime-4.3.1.jar javarosa.jar joda-time-2.0.jar kxml2-2.3.0.jar mgrs.jar opencsv-2.3.jar regexp-me.jar zip4j_1.3.2.jar
When adding exclude module: 'support-v4' to appcompat-v7 , the assembly fails and the debug log is displayed, I canβt load the main activity using index out of bound, length: 0, index: 3 :
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(net.lingala.zip4j.unzip.Unzip$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.
Launch
./gradlew -q projects ------------------------------------------------------------ Root project ------------------------------------------------------------ Root project 'opendatakit-collect' \--- Project ':deps' +--- Project ':deps:android-map-utils' | \--- Project ':deps:android-map-utils:library' +--- Project ':deps:google-maps-m4b' \--- Project ':deps:google-play-services'
Running ./gradlew :dependencies since I don't have a project name:
Incremental java compilation is an incubating feature. :dependencies ------------------------------------------------------------ Root project ------------------------------------------------------------ _debugAndroidTestAnnotationProcessor -