Android Studio 3.0中的DexGuard集成 [英] DexGuard integration in Android Studio 3.0

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

问题描述

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

警告:您使用的其中一个插件支持Java 8语言 特征.要尝试Android插件中内置的支持,请删除 以下来自您的build.gradle: Apply插件:'dexguard'要了解更多信息,请访问 https://d.android.com/r/tools/java-8-support-message.html

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

如果Android Studio检测到您的项目正在使用Jack, Retrolambda或 DexGuard ,IDE使用Java提供的Java 8支持. 那些工具代替.

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:

Warning:One of the plugins you are using supports Java 8 language features. To try the support built into the Android plugin, remove the following from your build.gradle: apply plugin: 'dexguard' To learn more, go to https://d.android.com/r/tools/java-8-support-message.html

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

If Android Studio detects that your project is using Jack, Retrolambda, or DexGuard, the IDE uses Java 8 support provided by those tools instead.

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集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆