I just added a library to my project, Gear VRF, and the build.gradle file for the library is unable to find the Oculus sdk. I am getting the error "not copying Oculus files: OVR_MOBILE_SDK not found, as well as "relying on hard-coded paths and environment variables; OVR_MOBILE_SDK not found. At the bottom of the Gradle log I also get "execution failed for task framework:buildNative. User/../../Android/sdk/ndk-bundle/ndk-build finished with nonzero exit value 2.
Any help on this issue is appreciated, I have put the code for the library's build.gradle below. Thanks.
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion '23.0.3'
defaultConfig {
minSdkVersion 19
targetSdkVersion 19
ndk {
moduleName "gvrf"
}
}
task copyOculusFiles(type: Copy) {
println "copying oculus binaries"
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
def oculusDir = rootProject.property("OVR_MOBILE_SDK")
copy {
from oculusDir+'/VrApi/Libs/Android/VrApi.jar'
into 'src/main/libs'
}
copy {
from oculusDir+'/VrApi/Libs/Android/armeabi-v7a/libvrapi.so'
into 'src/main/libs/armeabi-v7a'
}
copy {
from oculusDir+'/VrAppSupport/SystemUtils/Libs/Android/SystemUtils.jar'
into 'src/main/libs'
}
} else {
println "WARNING: not copying Oculus files; OVR_MOBILE_SDK not found"
}
}
task buildNative(type: Exec) {
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
environment 'OVR_MOBILE_SDK', rootProject.property("OVR_MOBILE_SDK")
} else {
println "WARNING: relying on hard-coded paths and environment variables; OVR_MOBILE_SDK not found"
}
def ndkbuild = ""
if (rootProject.hasProperty("ANDROID_NDK_HOME")) {
ndkbuild = rootProject.property("ANDROID_NDK_HOME")
ndkbuild += '/'
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
ndkbuild += 'ndk-build.cmd'
} else {
ndkbuild += 'ndk-build'
}
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
environment 'OVR_MOBILE_SDK', rootProject.property("OVR_MOBILE_SDK")
}
commandLine '/Users/edhillon3/Library/Android/sdk/ndk-bundle/ndk-build', '-C', file('src/main').absolutePath, '-j', 16//, 'NDK_DEBUG=1'
}
buildTypes {
debug {
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
releaseToGitHub {
}
}
sourceSets.main {
java.srcDirs = ['src/main/java', 'src/main/backends/oculus']
jni.srcDirs = [] // no auto generation of Android.mk
// pre-compiled libraries
jniLibs {
srcDir 'src/main/libs'
}
}
task cleanNative(type: Exec) {
def ndkbuild = ""
if (rootProject.hasProperty("ANDROID_NDK_HOME")) {
ndkbuild = rootProject.property("ANDROID_NDK_HOME")
ndkbuild += '/'
}
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
ndkbuild += 'ndk-build.cmd'
} else {
ndkbuild += 'ndk-build'
}
if (rootProject.hasProperty("OVR_MOBILE_SDK")) {
environment 'OVR_MOBILE_SDK', rootProject.property("OVR_MOBILE_SDK")
}
commandLine '/Users/edhillon3/Library/Android/sdk/ndk-bundle/ndk-build', '-C', file('src/main').absolutePath, '-j', 16, 'clean'
}
clean.dependsOn 'cleanNative'
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative, copyOculusFiles
}
task eclipseZip(type: Zip) {
into('GearVRf/res/') {
from 'src/main/res/'
}
into('GearVRf/libs/') {
from('src/main/libs/') {
exclude 'libassimp.so'
exclude 'libjnlua.so'
}
from('build/intermediates/bundles/release/') {
include 'classes.jar'
rename('classes.jar', 'gvrf.jar')
}
}
into('GearVRf/') {
from('src/main/') {
include 'AndroidManifest.xml'
include '.project'
include '.classpath'
include 'project.properties'
}
}
into('GearVRf/java') {
from('src/main/') {
include 'donotdelete.txt'
}
}
baseName 'gvrf-for-eclipse'
}
task eclipseAssembleReleaseToGitHub() << {
println "preparing android library project for eclipse"
eclipseZip.execute()
copy {
from 'build/distributions/gvrf-for-eclipse.zip'
into 'build/outputs/aar/'
}
project.delete('build/distributions/gvrf-for-eclipse.zip')
}
task uploadToGitHub(type: Exec) {
onlyIf {
System.env['RELEASE_ID'] != null
}
onlyIf {
System.env['ACCESS_TOKEN'] != null
}
commandLine '../../tools/upload_to_github', file('build/outputs/aar/framework-releaseToGitHub.aar').absolutePath
}
uploadToGitHub.doFirst {
println('uploading to github')
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(dir: 'src/main/libs', include: ['*.jar'])
}
assembleDebug {}.doLast {
task copyAARFiles(type: Copy) {
if (rootProject.hasProperty("LIBS_DIRECTORY")) {
println "copying aar files to the libs_directory"
def libsdirPath = projectDir.absolutePath + '/../../../' +
rootProject.property("LIBS_DIRECTORY")
def libsDir = new File(libsdirPath);
if (libsDir.exists()) {
from 'build/outputs/aar'
into libsDir
include '**/*.aar'
} else {
println "Cannot copy aar files, libs directory does not exist!"
}
}
}
assembleReleaseToGitHub {}.doLast {
println 'removing oculus binaries'
exec {
commandLine = ['zip', '-d', 'build/outputs/aar/framework-releaseToGitHub.aar', 'libs/VrApi.jar']
}
exec {
commandLine = ['zip', '-d', 'build/outputs/aar/framework-releaseToGitHub.aar', 'libs/SystemUtils.jar']
}
exec {
commandLine = ['zip', '-d', 'build/outputs/aar/framework-releaseToGitHub.aar', 'jni/armeabi-v7a/libvrapi.so']
}
eclipseAssembleReleaseToGitHub.execute()
uploadToGitHub.execute();
}
Find gradle.properties file and add the following:
# Un-comment and add the path to ovr directory
OVR_MOBILE_SDK=\.\.\/GearVRf\/ovr_mobile_sdk
Related
I'm trying to add this library to my app, but when I run the app I get this error :
Process 'command 'D:\Sdk\ndk-bundle\ndk-build.cmd'' finished with
non-zero exit value 2
Build.Gradle :
apply plugin: 'com.android.library'
android {
buildToolsVersion "28.0.3"
compileSdkVersion 28
sourceSets {
main {
java.srcDirs 'src'
res {
srcDirs 'res'
}
manifest.srcFile 'AndroidManifest.xml'
jni.srcDirs = []
jniLibs.srcDir 'libs'
}
}
task ndkBuild(type:Exec) {
workingDir file('./')
commandLine getNdkBuildCmd()
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
task cleanJni(type:Exec) {
workingDir file('./')
commandLine getNdkBuildCmd(), 'clean'
}
clean.dependsOn cleanJni
}
def getNdkBuildCmd() {
def ndkbuild = "D:\\Sdk\\ndk-bundle\\ndk-build.cmd"
return ndkbuild
}
Path :
Modify this function to give drive name 'D\'
def getNdkBuildCmd() {
def ndkbuild = "D\:\\Sdk\\ndk-bundle\\ndk-build.cmd"
return ndkbuild
}
I am using this https://github.com/quiet/org.quietmodem.Quiet link to transfer sound. This is a library so added it in project and in buld.gradle , i have compiled the project as :
compile project(':quiet')
My code for build.gradle(Module : quiet) is
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable = true
jniDebuggable = true
}
}
sourceSets { main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = []
} }
externalNativeBuild{
ndkBuild{
path "$projectDir/src/main/jni/Android.mk"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support:support-annotations:23.0.0'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test:runner:0.5'
compile 'com.android.support:appcompat-v7:23.1.1'
}
def getNdkDir() {
if (System.env.ANDROID_NDK_ROOT != null)
return System.env.ANDROID_NDK_ROOT
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkdir = properties.getProperty('ndk.dir', null)
if (ndkdir == null)
throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
return ndkdir
}
def getNdkBuildCmd() {
def ndkbuild = getNdkDir() + "/ndk-build"
if (Os.isFamily(Os.FAMILY_WINDOWS))
ndkbuild += ".cmd"
return ndkbuild
}
task ndkBuild(type:Exec, description: "Compile JNI Sources") {
workingDir file('src/main')
commandLine getNdkBuildCmd()
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkLibsToJar
}
task ndkLibsToJar(type: Zip, dependsOn: 'ndkBuild', description: 'Create a JAR of the native libs') {
destinationDir new File(buildDir, 'libs')
baseName 'ndk-libs'
extension 'jar'
from(new File(buildDir, 'libs')) { include '**/*.so' }
into 'lib/'
}
Now when i build my project , it throws ndk issues which is shown in the image
The issue I am facing is shown in the image
I followed the step by step guide found here:
https://www.codeproject.com/Articles/840623/Android-Character-Recognition
At step 2 when I added tess-two as module dependency to app and synced gradle, it failed with the following error:
Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :libraries:tess-two.
I have tried many combinations of settings.gradle and searched for hours, any help will be much appreciated, thanks!
build.gradle file under tess-two
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
consumerProguardFiles 'proguard-rules.pro'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
jni.srcDirs = []
jniLibs.srcDirs = ['libs']
}
}
// Call external ndk-build(.cmd) script to build the native code
task ndkBuild(type: Exec) {
def ndkDirProperty = properties.getProperty('ndk.dir')
def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''
def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath,
'-j', Runtime.runtime.availableProcessors()
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
// Cleanup task to remove previously generated binaries
task ndkClean(type: Exec) {
def ndkDirProperty = properties.getProperty('ndk.dir')
def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''
def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath, 'clean'
}
tasks.withType(Delete) {
cleanTask -> cleanTask.dependsOn ndkClean
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:tess-two')
}
// Settings for uploading module AAR to Bintray for library distribution
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError = false
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference","${android.sdkDirectory}/docs/reference"
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
install {
repositories.mavenInstaller {
pom.project {
name = 'tess-two'
packaging = 'aar'
groupId = 'com.rmtheis'
artifactId = 'tess-two'
developers {
developer {
id = 'rmtheis'
name = 'Robert Theis'
email = 'robert.m.theis#gmail.com'
}
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url 'https://github.com/rmtheis/tess-two'
}
}
}
}
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = 'maven'
name = 'tess-two'
userOrg = user
publish = true
}
}
settings.gradle
include ':app'
include ':libraries:tess-two'
include 'app:libraries:tess-two'
project(':libraries:tess-two').projectDir = new File('libraries/tess-two')
I am developing an Video Compression app so i am using NDK and getting error when run the app.
I seen the many stackOverflow Questions (Execution error in app:buildNative) but the stackOverflow solutions are not works for this error.
Gradle Build Message:
Gradle tasks [:app:assembleDebug]
:app:buildNative FAILED
Error:Execution failed for task ':app:buildNative'.
> A problem occurred starting process 'command 'null/ndk-build.cmd''
Is anyone help for my questions?
build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.xxxx.videocompressor"
minSdkVersion 16
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = [] // This prevents the auto generation of Android.mk
jniLibs.srcDir 'src/main/libs'
// This is not necessary unless you have precompiled libraries in your project.
}
task buildNative(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = android.ndkDirectory
commandLine "$ndkDir/ndk-build.cmd",
'-C', file('src/main/jni/').absolutePath, // Change src/main/jni the relative path to your jni source
'-j', Runtime.runtime.availableProcessors(),
'all',
'NDK_DEBUG=1'
}
task cleanNative(type: Exec, description: 'Clean JNI object files') {
def ndkDir = android.ndkDirectory
commandLine "$ndkDir/ndk-build.cmd",
'-C', file('src/main/jni/').absolutePath, // Change src/main/jni the relative path to your jni source
'clean'
}
clean.dependsOn 'cleanNative'
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn buildNative
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.+'
compile 'com.android.support:support-v4:22.2.+'
compile 'com.android.support:appcompat-v7:22.2.+'
compile 'com.android.support:recyclerview-v7:22.2.+'
compile 'com.android.support:design:22.2.+'
compile 'com.google.android.gms:play-services-ads:7.8.0'
}
Instead of using only this
// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath
} else {
commandLine 'ndk-build', '-C', file('src/main').absolutePath
}
}
Use this
// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath
} else {
commandLine 'ndk-build', '-C', file('src/main').absolutePath
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
I'm starting with NDK, and want to compile my first hello-world app with it.
My application is just a simple application with an Activity, and my MainActivity is in com.example.myapplication2.app
I would like to use a native method in it, and here is what I did :
MainActivity.java
#Override
protected void onCreate(Bundle savedInstanceState) {
TextView tv = new TextView(this);
tv.setText(stringFromJNI());
setContentView(tv);
}
public native String stringFromJNI();
static {
System.loadLibrary("hello-jni");
}
in my jni folder :
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello-jni
LOCAL_SRC_FILES := hello-jni.c
include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_ABI := all
hello-jni.c
#include <string.h>
#include <jni.h>
JNIEXPORT jstring JNICALL Java_com_example_myapplication2_app_MainActivity_stringFromJNI(JNIEnv* env, jobject thiz)
{
return (*env)->NewStringUTF(env, "Hello from native code!");
}
And here, my gradle :
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
productFlavors {
x86 {
versionCode Integer.parseInt("6" + defaultConfig.versionCode)
ndk {
abiFilter "x86"
}
}
mips {
versionCode Integer.parseInt("4" + defaultConfig.versionCode)
ndk {
abiFilter "mips"
}
}
armv7 {
versionCode Integer.parseInt("2" + defaultConfig.versionCode)
ndk {
abiFilter "armeabi-v7a"
}
}
arm {
versionCode Integer.parseInt("1" + defaultConfig.versionCode)
ndk {
abiFilter "armeabi"
}
}
fat
}
}
def getVersionCodeFromManifest() {
def manifestFile = file(android.sourceSets.main.manifest.srcFile)
def pattern = Pattern.compile("versionCode=\"(\\d+)\"")
def matcher = pattern.matcher(manifestFile.getText())
matcher.find()
return Integer.parseInt(matcher.group(1))
}
task copyNativeLibs(type: Copy, dependsOn: 'buildNative') {
// TODO fix deprecated
dependsOn 'buildNative'
from(new File('src/main/libs')) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniFolders = new HashSet<File>();
pkgTask.jniFolders.add(new File(projectDir, 'native-libs'))
}
task buildNative(type: Exec) {
if (System.env.ANDROID_NDK != null) {
def ndkBuild = new File(System.env.ANDROID_NDK, 'ndk-build')
workingDir "src/main/jni"
commandLine 'cmd', '/c', '%ANDROID_NDK%\\ndk-build'
//executable ndkBuild
} else {
doLast {
println '##################'
println 'Skipping NDK build'
println 'Reason: ANDROID_NDK not set.'
println '##################'
}
}
}
task nativeLibsToJar(
type: Zip,
description: 'create a jar archive of the native libs') {
destinationDir file("$buildDir/native-libs")
baseName 'native-libs'
extension 'jar'
from fileTree(dir: 'libs', include: '**/*.so')
into 'lib/'
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
When I want to run my project, I have no C error (I had before, that's why I'm sure compilation is done, and OK).
But, when I want to run the application, I have the error :
java.lang.UnsatisfiedLinkError: Native method not found: com.example.myapplication2.app.MainActivity.stringFromJNI:()Ljava/lang/String;
What I've checked is (Android NDK Native method not found error) :
com.example.myapplication2.app.MainActivity.stringFromJNI and Java_com_example_myapplication2_app_MainActivity_stringFromJNI are matching
extern "C" is not present, because when I used it, I encountered this error : Error: "expected '(' before string constant"
May you know why I encounter this error ?
Add a System.loadLibrary("hello-jni") call to your app startup. Static constructor would be a good place.
The error was in gradle file, which was not doing everything.
Here is my final .gradle file.
Before compilation, it adds three tasks before compilation to do the following :
Run the NDK build
Copy the *.so files from /src/main/libs to /build/lib
Compress the /build/lib folder into /libs/lib.jar
Requirements :
Your bin folder of JDK must be in the PATH environment variable
You must have an ANDROID_NDK environment variable with the path to your NDK (the one downloaded on Android website)
Then, it will include all the needed .so files into your application, without any ndk command needed in your gradle.
Advantage of it : One APK for all platforms
Inconvenient of it : APK bigger, because it contains .so files for all platforms.
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
ndk {
moduleName "hello-jni"
}
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
}
task buildNative(type: Exec) {
if (System.env.ANDROID_NDK != null) {
println 'Running NDK build'
workingDir "src/main"
commandLine 'cmd', '/c', '%ANDROID_NDK%/ndk-build'
} else {
doLast {
println '##################'
println 'Skipping NDK build'
println 'Reason: ANDROID_NDK not set.'
println '##################'
}
}
}
task copyNativeLibs(dependsOn:buildNative, type: Copy) {
println 'Copying *.so files from /src/main/libs to /build/lib'
from(new File('src/main/libs')) { include '**/*.so' }
into new File(buildDir, 'lib')
}
task nativeLibsToJar(dependsOn:copyNativeLibs, type: Exec, description: 'create a jar archive of the native libs') {
println 'Compressing /build/lib into /libs/lib.jar'
workingDir "build"
commandLine 'cmd', '/c', 'jar cf ../libs/lib.jar lib'
}
tasks.withType(Compile) { compileTask -> compileTask.dependsOn nativeLibsToJar }
clean.dependsOn 'cleanCopyNativeLibs'
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
pkgTask.jniFolders = new HashSet<File>();
pkgTask.jniFolders.add(new File(projectDir, 'native-libs'))
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}