如何在Android Studio中为特定项目禁用NDK [英] How to disable NDK for a certain project in Android Studio

查看:400
本文介绍了如何在Android Studio中为特定项目禁用NDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理多个项目,有些需要安装NDK.当我在SDK管理器中执行此操作时,除非我在SDK管理器中删除了NDK,否则所有非NDK项目都无法生成APK.我尝试在我的local.properties中指定并删除NDK路径,但没有执行任何操作,我需要将其从Android Studio中完全删除才能生成APK,然后重新下载它并为我的NDK项目启用它.真是荒唐.可以解决吗?

I have multiple projects I'm working on, and some require NDK to be installed. When I do that in the SDK manager, all my non-NDK projects fail to generate the APK unless I removed NDK on the SDK manager. I tried specifying and removing the NDK path, in my local.properties, nothing does it, I need to completely remove it from Android Studio to be able to generate the APK, then re-download it and enable it for my NDK projects, which is pretty absurd. Any way around this??

推荐答案

无法运行mips64el-linux-android-strip

这是已知问题,发生于您拥有最新的NDK r.17,并且不要在根(项目) build.gradle 脚本中将gradle插件升级到3.1.2或更高版本.建议使用最新的插件,不仅要与最新的NDK兼容:

This is a known problem, which happens when you have the latest NDK r.17 and don't upgrade your gradle plugin to 3.1.2 or higher, in root (project) build.gradle script. Using the latest plugin is recommended not only to be compliant with latest NDK:

buildscript {
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
  }
}

您还必须更改 gradle/wrapper/gradle-wrapper.properties :

distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip v.4.4

解决方法包括使用 NDK r.16 不包括mips条 *)

The workarounds include using NDK r.16 or excluding the mips strips *)

packagingOptions {
    doNotStrip '*/mips/*.so'
    doNotStrip '*/mips64/*.so'
}


*)为@ Forgen 正确


*) as @Forgen correctly updated, packagingOptions was not available for Android gradle plugin earlier than v.2.3. But if you are still using such version, you have problems much more serious than mips64, and should upgrade ASAP.

这篇关于如何在Android Studio中为特定项目禁用NDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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