相关疑难解决方法(0)

不推荐使用android.dexOptions.incremental属性

尝试运行gradle构建时,我在Android Studio 2.2中收到以下警告:

警告:该android.dexOptions.incremental属性已弃用,它对构建过程没有影响.

在此输入图像描述

在build.gradle文件中,我声明了dexOptions

dexOptions {
   incremental true
   jumboMode = true
}
Run Code Online (Sandbox Code Playgroud)

如果不推荐使用,那么该属性的备用选项是什么.

android android-studio android-gradle-plugin

66
推荐指数
2
解决办法
4万
查看次数

将字节码转换为dex时出错:原因:java.lang.RuntimeException:异常解析类 - Android studio 2.0 beta 6

我用gradle更新到最新版本的Android studio 2.0 Beta 6:

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-beta6'
}
Run Code Online (Sandbox Code Playgroud)

该应用程序在模拟器和设备上运行完美,我测试了所有东西,它工作正常.

只有当我尝试生成签名APK时,我才会收到很多错误,

我在依赖项中遇到了一些错误,当我排除了矢量drawable,vector animate drawable和Support-v4库时,所有这些都解决了

现在我没有任何依赖性错误.

现在我的app模块的gradle.build看起来像这样:

apply plugin: 'com.android.application'

android {
    configurations {
        //all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude module: 'animated-vector-drawable'
        all*.exclude module: 'support-vector-drawable'
        //all*.exclude module: 'support-v4'

    }
    repositories {
        maven { url "https://jitpack.io" }

    }
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1"

//        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        } …
Run Code Online (Sandbox Code Playgroud)

android gradle build.gradle android-gradle-plugin

23
推荐指数
3
解决办法
7万
查看次数

Android Studio 2.1将字节码转换为dex时出错

自从我将android studio从2.0更新到2.1后,我收到以下错误.

错误:将字节码转换为dex时出错:

原因:Dex无法解析版本52字节的代码.这是由使用Java 8或更高版本编译的库依赖项引起的.如果您在库子模块中使用'java'gradle插件,请将targetCompatibility ='1.7'sourceCompatibility ='1.7'添加到该子模块的build.gradle文件中.

我尝试在build.gradle中添加以下代码段,但问题仍然存在

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
Run Code Online (Sandbox Code Playgroud)

我看到了一些与此相似的问题,但两个问题都没有得到解答.任何人都可以帮我解决这个问题吗?提前致谢.

java android android-studio android-gradle-plugin

10
推荐指数
1
解决办法
2万
查看次数

混淆(minifyEnabled true)在调试和发布中不起作用

我无法在调试和发布模式下使用 minifyEnabled true 运行 apk。我参考了下面的链接,但没有一个对我有用。

1. Android-错误:执行失败的任务“:应用程序:transformClassesWithDexForRelease”

2.将字节码转换为 dex 时出错:原因:java.lang.RuntimeException: Exception parsing classes - Android studio 2.0 beta 6

下面是应用程序 build.gradle 文件

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    defaultConfig {
        applicationId 'XX.XX.XXX'
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 9
        versionName "1.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true



    }



    sourceSets.main {
        jni.srcDirs = [] //disable automatic ndk-build call
        jniLibs.srcDir 'src/main/libs' //integrate your libs from libs instead of jniLibs
    }
    dexOptions {
        javaMaxHeapSize "4g" //specify the heap size for the …
Run Code Online (Sandbox Code Playgroud)

encryption obfuscation android

5
推荐指数
1
解决办法
7946
查看次数

我用java 7 android studio错误替换java 8?

为什么我用JAVA 7替换JAVA 8,安卓工作室错误?

> Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using  Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:...while parsing android/support/v7/recyclerview/R$attr.class
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have …
Run Code Online (Sandbox Code Playgroud)

android android-studio

4
推荐指数
2
解决办法
1万
查看次数