Task 'make' not found in root project

419 views
Skip to first unread message

Mehmet Emre Aydinli

unread,
Nov 4, 2015, 3:03:12 PM11/4/15
to android-ndk
Hi,

I have a java library that is part of a larger app project. It uses JNI to use a .cpp.

I am using Android Studio, and Gradle. When I do "gradle build" everything works beautifully and I can see everything built. However, when I do "gradle make" (same as Menu --> Build --> Make Project), I get "Task 'make' not found in root project" Somehow "gradle make" cannot find "make" to use for ndk-build. I am using Android.mk and Application.mk . 

What do you think?

Mehmet Emre Aydinli

unread,
Nov 4, 2015, 3:15:51 PM11/4/15
to android-ndk
BTW, my native code is in C++

Andrew Esh

unread,
Nov 5, 2015, 9:18:05 PM11/5/15
to android-ndk
Try "gradle build".

Mehmet Emre Aydinli

unread,
Nov 6, 2015, 10:14:58 AM11/6/15
to android-ndk

Yes, as I said in the original post, "gradle build" works. I am trying to understand why "gradle build" works and "gradle make" doesn't.

On Thursday, November 5, 2015 at 8:18:05 PM UTC-6, Andrew Esh wrote:
Try "gradle build".

Alex Cohn

unread,
Nov 9, 2015, 1:18:11 PM11/9/15
to android-ndk
To use Android.mk with Gradle, you had to modify your build.gradle files. What changes did you introduce?

BR
Alex

Mehmet Emre Aydinli

unread,
Nov 9, 2015, 3:34:25 PM11/9/15
to andro...@googlegroups.com
I have a few parts in my build.gradle:
- task ndkBuild

task ndkBuild(type: Exec) {
    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
        commandLine 'ndk-build.cmd', '-C', file('src/main/').absolutePath
    } else {
        commandLine 'ndk-build clean', '-C', file('src/main/').absolutePath
        commandLine 'ndk-build', '-C', file('src/main/').absolutePath
    }
}

- dependsOn block to make sure ndkBuild happens before javac
 tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn ndkBuild
}

Then there are misc parts which builds the version text, creating and zipping the deliverables folder. 

--
You received this message because you are subscribed to a topic in the Google Groups "android-ndk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-ndk/PbPCHd6IDjo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.



--
Mehmet Emre Aydinli

Alex Cohn

unread,
Nov 10, 2015, 9:58:47 AM11/10/15
to android-ndk
This really looks strange. I don't have a gradle task make, but for me Menu --> Build --> Make Project performs gradle build.

Best luck,
Alex

Mehmet Emre Aydinli

unread,
Nov 12, 2015, 6:07:15 PM11/12/15
to android-ndk

In case anybody stumbles upon this thread, here is how I worked around it. I created a separate project my jni library from which I build the shared object and the jar. Then I include those in the main app project. 
Reply all
Reply to author
Forward
0 new messages