Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable NDK for a certain project in Android Studio

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??

like image 699
Hey'Youssef Avatar asked Jun 19 '18 12:06

Hey'Youssef


1 Answers

cannot run mips64el-linux-android-strip

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'
  }
}

You also must change gradle/wrapper/gradle-wrapper.properties:

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

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

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

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

like image 69
Alex Cohn Avatar answered Oct 14 '22 05:10

Alex Cohn