我正在将应用程序从2.3升级到Nougat(SDK 25).当我添加com. android.support:appcompat-v7:25.0.0以支持ActivityCompat.requestPermissions时.当我在调试模式下运行它时,应用程序运行没有问题,但使用./gradlew assembleDebug运行会导致以下错误:
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

当我在调试模式下运行时,应用程序构建没有问题,但是,当我尝试构建APK时,我得到上面的错误.

有没有办法可以追踪重复的包裹?我运行了以下内容:

./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)

这是我的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()
    }
}

libs中的文件:armeabi / libcryptowrapper.so
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

将exclude module:’support-v4’添加到appcompat-v7时,构建失败仍然显示调试日志,无法加载索引超出范围的主活动,长度:0,索引: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.

运行

./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'

运行./gradlew:依赖项,因为我似乎没有项目名称:

Incremental java compilation is an incubating feature.
:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

_debugAndroidTestAnnotationProcessor - ## Internal use,do not manually configure ##
No dependencies

_debugAndroidTestApk - ## Internal use,do not manually configure ##
\--- com.android.support:multidex-instrumentation:1.0.1
     \--- com.android.support:multidex:1.0.1

_debugAndroidTestCompile - ## Internal use,do not manually configure ##
\--- com.android.support:multidex-instrumentation:1.0.1
     \--- com.android.support:multidex:1.0.1

_debugAnnotationProcessor - ## Internal use,do not manually configure ##
No dependencies

_debugApk - ## Internal use,do not manually configure ##
+--- 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:google-maps-m4b
+--- project :deps:android-map-utils:library
|    \--- project :deps:google-maps-m4b
\--- project :deps:google-play-services

_debugCompile - ## Internal use,do not manually configure ##
+--- 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:google-maps-m4b
+--- project :deps:android-map-utils:library
|    \--- project :deps:google-maps-m4b
\--- project :deps:google-play-services

_debugUnitTestAnnotationProcessor - ## Internal use,do not manually configure ##
No dependencies

_debugUnitTestApk - ## Internal use,do not manually configure ##
No dependencies

_debugUnitTestCompile - ## Internal use,do not manually configure ##
No dependencies

_releaseAnnotationProcessor - ## Internal use,do not manually configure ##
No dependencies

_releaseApk - ## Internal use,do not manually configure ##
+--- 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:google-maps-m4b
+--- project :deps:android-map-utils:library
|    \--- project :deps:google-maps-m4b
\--- project :deps:google-play-services

_releaseCompile - ## Internal use,do not manually configure ##
+--- 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:google-maps-m4b
+--- project :deps:android-map-utils:library
|    \--- project :deps:google-maps-m4b
\--- project :deps:google-play-services

_releaseUnitTestAnnotationProcessor - ## Internal use,do not manually configure ##
No dependencies

_releaseUnitTestApk - ## Internal use,do not manually configure ##
No dependencies

_releaseUnitTestCompile - ## Internal use,do not manually configure ##
No dependencies

androidJacocoAgent - The Jacoco agent to use to get coverage data.
\--- org.jacoco:org.jacoco.agent:0.7.5.201505241946

androidJacocoAnt - The Jacoco ant tasks to use to get execute Gradle tasks.
\--- org.jacoco:org.jacoco.ant:0.7.5.201505241946
     +--- org.jacoco:org.jacoco.core:0.7.5.201505241946
     |    \--- org.ow2.asm:asm-debug-all:5.0.1
     +--- org.jacoco:org.jacoco.report:0.7.5.201505241946
     |    +--- org.jacoco:org.jacoco.core:0.7.5.201505241946 (*)
     |    \--- org.ow2.asm:asm-debug-all:5.0.1
     \--- org.jacoco:org.jacoco.agent:0.7.5.201505241946

androidTestAnnotationProcessor - Classpath for the annotation processor for 'androidTest'.
No dependencies

androidTestApk - Classpath packaged with the compiled 'androidTest' classes.
No dependencies

androidTestCompile - Classpath for compiling the androidTest sources.
No dependencies

androidTestProvided - Classpath for only compiling the androidTest sources.
No dependencies

androidTestWearapp - Link to a wear app to embed for object 'androidTest'.
No dependencies

annotationProcessor - Classpath for the annotation processor for 'main'.
No dependencies

apk - Classpath packaged with the compiled 'main' classes.
No dependencies

archives - Configuration for archive artifacts.
No dependencies

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:google-maps-m4b
+--- project :deps:android-map-utils:library
|    \--- project :deps:google-maps-m4b
\--- project :deps:google-play-services

debugAnnotationProcessor - Classpath for the annotation processor for 'debug'.
No dependencies

debugApk - Classpath packaged with the compiled 'debug' classes.
No dependencies

debugCompile - Classpath for compiling the debug sources.
No dependencies

debugProvided - Classpath for only compiling the debug sources.
No dependencies

debugWearapp - Link to a wear app to embed for object 'debug'.
No dependencies

default - Configuration for default artifacts.
No dependencies

default-mapping - Configuration for default mapping artifacts.
No dependencies

default-Metadata - Metadata for the produced APKs.
No dependencies

instrumentTestAnnotationProcessor - Classpath for the annotation processor for 'instrumentTest'.
No dependencies

instrumentTestApk - Classpath packaged with the compiled 'instrumentTest' classes.
No dependencies

instrumentTestCompile - Classpath for compiling the instrumentTest sources.
No dependencies

instrumentTestProvided - Classpath for only compiling the instrumentTest sources.
No dependencies

instrumentTestWearapp - Link to a wear app to embed for object 'instrumentTest'.
No dependencies

provided - Classpath for only compiling the main sources.
No dependencies

releaseAnnotationProcessor - Classpath for the annotation processor for 'release'.
No dependencies

releaseApk - Classpath packaged with the compiled 'release' classes.
No dependencies

releaseCompile - Classpath for compiling the release sources.
No dependencies

releaseProvided - Classpath for only compiling the release sources.
No dependencies

releaseWearapp - Link to a wear app to embed for object 'release'.
No dependencies

testAnnotationProcessor - Classpath for the annotation processor for 'test'.
No dependencies

testApk - Classpath packaged with the compiled 'test' classes.
No dependencies

testCompile - Classpath for compiling the test sources.
No dependencies

testDebugAnnotationProcessor - Classpath for the annotation processor for 'testDebug'.
No dependencies

testDebugApk - Classpath packaged with the compiled 'testDebug' classes.
No dependencies

testDebugCompile - Classpath for compiling the testDebug sources.
No dependencies

testDebugProvided - Classpath for only compiling the testDebug sources.
No dependencies

testDebugWearapp - Link to a wear app to embed for object 'testDebug'.
No dependencies

testProvided - Classpath for only compiling the test sources.
No dependencies

testReleaseAnnotationProcessor - Classpath for the annotation processor for 'testRelease'.
No dependencies

testReleaseApk - Classpath packaged with the compiled 'testRelease' classes.
No dependencies

testReleaseCompile - Classpath for compiling the testRelease sources.
No dependencies

testReleaseProvided - Classpath for only compiling the testRelease sources.
No dependencies

testReleaseWearapp - Link to a wear app to embed for object 'testRelease'.
No dependencies

testWearapp - Link to a wear app to embed for object 'test'.
No dependencies

wearapp - Link to a wear app to embed for object 'main'.
No dependencies

BUILD SUCCESSFUL

Total time: 13.053 secs

This build Could be faster,please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html

解决方法

感谢您编辑问题.由于有很多jar库,我们几乎不可能复制错误.

所以,这里有一些尝试.由于您在添加com.android.support:appcompat-v7:25.0.0 lib后出现错误,请执行以下操作:

compile (compile 'com.android.support:appcompat-v7:25.0.0') {
    exclude module: 'support-v4'
}

查看它是否有效或错误是否发生变化

编辑:

您运行了以下命令:./ gradlew -q dependencies:dependencies –configuration compile

您可以在Android Studio终端中运行此命令,并在您的问题中发布debugApk和releaseApk依赖项.

命令(如果模块名称不同,则将应用程序更改为模块名称):

./gradlew app:dependencies

android – Build在debug中运行,在release中失败 – ZipException重复条目的更多相关文章

  1. HTML5地理定位_动力节点Java学院整理

    地理位置(Geolocation)是 HTML5 的重要特性之一,提供了确定用户位置的功能,借助这个特性能够开发基于位置信息的应用。今天这篇文章向大家介绍一下 HTML5 地理位置定位的基本原理及各个浏览器的数据精度情况

  2. 适用于iOS和路线的Google Maps SDK

    解决方法库中有一些东西不在文档中,所以如果你正在寻找一个功能,那么值得下载SDK并查看标题.然而,在当前版本1.0.2中,我没有看到任何路由–搜索路线或绘制路线.目前,您唯一的选择可能是使用其他GoogleApi来查找路径,然后正如Lee所说,使用折线绘制它们.

  3. 适用于iOS的Google Maps SDK不断增加内存使用量

    我已经构建了一个在地图上显示标记的简单应用程序,我从服务器的JSON文件加载其x,y,标记是可点击的,所以一旦你在任何标记上它将你带到另一个UIViewController(我们将它命名为BViewController).我已经监视了内存使用情况,所以每次我从BViewController返回到MapViewController(里面的地图)时,它只是内存使用量的两倍我尝试将其设置为nill或从s

  4. 通过cocoapods安装适用于iOS的Google Maps SDK会导致链接器错误

    我正在尝试使用cocoapods安装适用于iOS版本1.3.0的GoogleMapsSDK.实际上安装过程很成功,但是当我尝试使用框架时,app构建过程会返回链接器错误,例如:由于某种原因,链接器无法找到框架.我的cocoapods版本是0.20.1.XCode4.6.2.除了谷歌地图SDK,我的项目还有另外两个通过cocoapods添加的库.这是我的Podfile:提前致谢.解决方法您应该看到一个文件“Pods.xcconfig”,其中包含pod正在使用的框架.将应用程序的目标配置更改为基于CocoaP

  5. 在我的iOS应用中实施新的Google Maps SDK

    没有玷污测试它,但似乎是正确的.他们给我发了this个网页.祝好运!.您可能必须从项目中删除对armv7s的支持.

  6. ios – Google商家信息自动填充功能 – 如何获得纬度和经度?

    解决方法仅使用此URL不可能:我需要做的就是从响应中获取place_id,然后在NEXT以下URL中使用它:哪里:PLACE_ID–从先前的请求中检索到的place_id.API_KEY–Google生成的密钥,用于我的应用.必须使用上述网址中的详细信息替换自动填充功能.

  7. 在编译时编译Xcode中的C类错误:stl vector

    我有一个C类,用gcc和可视化工作室中的寡妇在linux上编译.boid.h:并在boid.cpp中:但是,当我在Xcode中编译此代码时,我收到以下错误:有任何想法吗?我以为你可以使用C/C++代码并在Xcode中编译没有问题?.m文件被视为具有Objective-C扩展名的.c文件..mm文件被视为具有Objective-C扩展名的.cpp文件,那么它被称为Objective-C只需将.m文件重命名为.mm,右键单击或按住Ctrl键并在Xcode中的文件中选择重命名.

  8. ios – 绘制MKMapView Overlay,如Google Maps Directions

    iOS5改变了内置GoogleMapsApp绘制路线的方式:我现在想在我自己的应用程序中复制路由叠加层的设计,但我目前只能绘制一条纯蓝色的线条.我想添加渐变,边框和辉光的3D效果.关于如何实现这一点的任何想法?目前我正在使用以下代码:导致一个相当丑陋的行:谢谢!

  9. 使用纬度和经度打开iOS地图

    我使用这个代码打开地图应用程序看来它的效果很好,但是这个位置上没有引脚.如何添加引脚,我想在请求中有其他参数?解决方法如果您希望将引脚放置在Apple的GoogleMaps应用程序上,请在URL中使用“q”而不是“ll”.你可以这样使用

  10. ios – 使用Google地图和Apple Maps URL方案自动开始导航

    在iOS上使用URL方案启动GoogleMaps或AppleMaps时,有没有办法自动启动导航?我看到两个可选参数,但没有用户输入就没有开始导航.解决方法这是我如何为你的参考,但对于苹果,我还没有找到一种方法来启动通过网址方案导航.

随机推荐

  1. bluetooth-lowenergy – Altbeacon库无法在Android 5.0上运行

    昨天我在Nexus4上获得了Android5.0的更新,并且altbeacon库停止了检测信标.似乎在监视和测距时,didEnterRegion和didRangeBeaconsInRegion都没有被调用.即使RadiusNetworks的Locate应用程序现在表现不同,一旦检测到信标的值,它们就不再得到更新,并且通常看起来好像信标超出了范围.我注意到的一点是,现在在logcat中出现以下行“B

  2. android – react-native动态更改响应者

    我正在使用react-native进行Android开发.我有一个视图,如果用户长按,我想显示一个可以拖动的动画视图.我可以使用PanResponder实现这一点,它工作正常.但我想要做的是当用户长按时,用户应该能够继续相同的触摸/按下并拖动新显示的Animated.View.如果您熟悉Google云端硬盘应用,则它具有类似的功能.当用户长按列表中的任何项目时,它会显示可拖动的项目.用户可以直接拖

  3. android – 是否有可能通过使用与最初使用的证书不同的证书对其进行签名来发布更新的应用程序

    是否可以通过使用与最初使用的证书不同的证书进行签名来发布Android应用程序的更新?我知道当我们尝试将这样的构建上传到市场时,它通常会给出错误消息.但有没有任何出路,比如将其标记为主要版本,指定市场中的某个地方?解决方法不,你不能这样做.证书是一种工具,可确保您是首次上传应用程序的人.所以总是备份密钥库!

  4. 如何检测Android中是否存在麦克风?

    ..所以我想在让用户访问语音输入功能之前检测麦克风是否存在.如何检测设备上是否有麦克风.谢谢.解决方法AndroidAPI参考:hasSystemFeature

  5. Android – 调用GONE然后VISIBLE使视图显示在错误的位置

    我有两个视图,A和B,视图A在视图B上方.当我以编程方式将视图A设置为GONE时,它将消失,并且它正下方的视图将转到视图A的位置.但是,当我再次将相同的视图设置为VISIBLE时,它会在视图B上显示.我不希望这样.我希望视图B回到原来的位置,这是我认为会发生的事情.我怎样才能做到这一点?编辑–代码}这里是XML:解决方法您可以尝试将两个视图放在RelativeLayout中并相对于彼此设置它们的位置.

  6. android – 获得一首歌的流派

    我如何阅读与歌曲相关的流派?我可以读这首歌,但是如何抓住这首歌的流派,它存放在哪里?解决方法检查此代码:

  7. android – 使用textShadow折叠工具栏

    我有一个折叠工具栏的问题,在展开状态我想在文本下面有一个模糊的阴影,我使用这段代码:用:我可以更改textColor,它可以工作,但阴影不起作用.我为阴影尝试了很多不同的值.是否可以为折叠文本投射阴影?

  8. android – 重用arm共享库

    我已经建立了armarm共享库.我有兴趣重用一个函数.我想调用该函数并获得返回值.有可能做这样的事吗?我没有任何头文件.我试过这个Android.mk,我把libtest.so放在/jni和/libs/armeabi,/lib/armeabi中.此时我的cpp文件编译,但现在是什么?我从objdump知道它的名字编辑:我试图用这个android.mk从hello-jni示例中添加prebuild库:它工作,但libtest.so相同的代码显示以下错误(启动时)libtest.so存在于libhello-j

  9. android – 为NumberPicker捕获键盘’Done’

    我有一个AlertDialog只有一些文本,一个NumberPicker,一个OK和一个取消.(我知道,这个对话框还没有做它应该保留暂停和恢复状态的事情.)我想在软键盘或其他IME上执行“完成”操作来关闭对话框,就像按下了“OK”一样,因为只有一个小部件可以编辑.看起来处理IME“Done”的最佳方法通常是在TextView上使用setonEditorActionListener.但我没有任何Te

  10. android – 想要在调用WebChromeClient#onCreateWindow时知道目标URL

    当我点击一个带有target=“_blank”属性的超链接时,会调用WebChromeClient#onCreateWindow,但我找不到新的窗口将打开的新方法?主页url是我唯一能知道的东西?我想根据目标网址更改应用行为.任何帮助表示赞赏,谢谢!

返回
顶部