本文介绍了Android Studio 3.0中的DexGuard集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经升级了Android项目,以使用最新的Android Studio 3.0功能.从那时起,我在每个Gradle同步中都收到以下警告消息:

如果我转到链接的URL,则可以看到:

Jack和Retrolambda有迁移文档,而DexGuard没有.

我的问题是:

  • 我可以删除DexGuard插件,它仍然可以按预期运行吗?
  • 如果否,我应该如何解决该警告?

我正在运行Android Studio 3.0和DexGuard 8.0.16

解决方案

您可能正在使用Dexguard进行代码混淆,加密或篡改检测.因此,将其删除将删除这些功能.您应该试用dexguard的8.0.17版本,并从构建配置中删除retrolamb,Jack和Dexguard-java8插件.

在我的应用程序上,它似乎仍然可以正常工作,在8.0.15/8.0.16上,我仍然必须启用dexguard-java8才能使其正常工作.

在您的应用程序build.gradle中添加此选项以启用java8编译.

apply plugin: 'dexguard'
...
android {
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

在您的project.gradle中添加

buildscript {
  repositories {
    flatDir { dirs 'dexguard' }
    ...
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
    classpath ':dexguard:'
    ...
  }
}

并确保gradle文件中没有对retrolambda或dexguard-java8的引用,并且一切正常.

I have upgraded my Android project to use the latest Android Studio 3.0 features. Since then, I am getting the following warning message on each Gradle sync:

If I go to the linked URL, I can see:

There are migration docs for Jack and Retrolambda, but none for DexGuard.

My questions are:

  • Can I remove the DexGuard plugin and it will still work as expected?
  • If no, how should I go around resolving this warning?

I am running Android Studio 3.0 and DexGuard 8.0.16

解决方案

You are probably using Dexguard for code obfuscation, encryption or tamper detection. So removing it will remove those functionalities. You should try out the 8.0.17 release of dexguard and remove retrolamb, Jack and the Dexguard-java8 plugin from your build config.

On my app this seems to keep working, on 8.0.15/8.0.16 I still had to enable dexguard-java8 to have it working.

in your app build.gradle add this to enable java8 compiling.

apply plugin: 'dexguard'
...
android {
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

In your project.gradle just add

buildscript {
  repositories {
    flatDir { dirs 'dexguard' }
    ...
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.0.0'
    classpath ':dexguard:'
    ...
  }
}

and make sure there are no references to retrolambda or dexguard-java8 in your gradle files and everything should work fine.

这篇关于Android Studio 3.0中的DexGuard集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-15 09:22