4

I'm trying build NDK project with new Gradle experimental plugin, but it seems that Gradle ignores the Android.mk and starts to compile everything without paying an attention to what written in the Android.mk, I am aware of the new syntax and I read the following Experimental Plugin User Guide also I tried the following syntax:

    android.sources {
    main {
        jni {
            source {
                srcDirs = []
            }
        }
    }
}

but it still ignoring the Android.mk file. I'm using:

  • Android Studio 1.3.1 stable
  • Gradle 2.5 with experimental plugin 0.2.0

Can anyone advise to that?

VitalyD
  • 289
  • 1
  • 15
  • A search found several StackOverflow questions that seemed related to this, e.g. http://stackoverflow.com/questions/27833530/how-to-use-my-own-android-mk-file-with-android-sudio – Michael Aug 19 '15 at 07:42
  • searched the whole StackOverflow , please pay attention that I'm using the new gradle experimental plugin that has different syntax and works different than the standard gradle. – VitalyD Aug 19 '15 at 11:27

2 Answers2

4

if you set

android.sources{
    main.jni {
        source {
            srcDirs = ['src/main/none'] // [] could be set instead but will disable even symbol resolution inside the editor
        }
    }
    main.jniLibs {
        source {
            srcDirs = ['src/main/libs']
        }
    }
}

Android Studio will not try to build your sources, and it will integrate your .so files that are inside src/main/libs/<abi>/

That means you can call ndk-build yourself, and your Makefiles will not be ignored.

ph0b
  • 14,353
  • 4
  • 43
  • 41
  • This works, but there's some typos: srcDirs = ['src/main/none'] srcDirs = ['src/main/libs'] – Anthony Aug 29 '15 at 12:14
  • Any chance you have advice on a similar jni.source question: http://stackoverflow.com/questions/32285107/gradle-experimental-includes – Anthony Aug 29 '15 at 12:20
0

Try to put:

 android.useDeprecatedNdk=true

Inside your gradle.properties file.

Then, you should be able to use the syntax you mention in your question.

Symbiosoft
  • 4,681
  • 6
  • 32
  • 46
  • that will work but i'm trying to use experimental plugin to get ndk debugging ability. – VitalyD Aug 21 '15 at 11:08
  • I think they drop the support of the Android.mk file with the new experimental plugin. You have to use gradle's build.gradle. I will be glade if someone could prove me wrong on this! – Symbiosoft Aug 21 '15 at 13:46