I have a multi module Android project. Some input data for the environment:
Android Studio 1.0.1
Gradle 2.2.1 (Gradle Wrapper)
Java 1.7.0_71
Android Gradle Plugin: 1.0.1
compileSdkVersion = 21
buildToolsVersion = '21.1.2'
minSdkVersion = 14
targetSdkVersion = 21
When I run the project from Android Studio. The application compiles and executes properly on the device (for all build variants). But when I try to assemble the app from the terminal with ./gradlew clean assembleDebug or any other build variant (I have 4: debug, alpha, beta, release) the build succeeds but when I try to run it the app crashes with a java.lang.NoClassDefFoundError for any of the classes defined in a module project.
I've excluded ProGuard as a suspect because it's run only on the release varian. But the issue is consistent for all builds.
Also I checked that modules don't contain repetitive dependencies.
EDIT
One posible Stack trace:
9553-9553/my.package.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: my.package.app, PID: 9553
java.lang.NoClassDefFoundError: my.package.module1.Go
at my.package.app.MyApplication.onCreate(MyApplication.java:59)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4729)
at android.app.ActivityThread.access$1600(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
As you see class Go is part of package my.package.module1 which is defined in a sub module :module1 (See build script source).
Part of the gradle build:
buildscript {
repositories {
mavenCentral()
}
dependencies{
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
android {
// ...
// Compile and tools version
defaultConfig {
// Target sdk and so on
applicationId 'my.package.app'
// ...
// Other stuff regarding version
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release { // ... }
alpha { // ... }
beta { // ... }
debug { // ... }
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
dependencies {
// ...
// Standatrt dependencies like support lib and others
compile project(':module1')
compile project(':module2')
compile project(':module3')
// Other moduels
}
After playing around with the build scripts and comparing the way AS assembles a build with the terminal one I've stumbled into the next differences:
When AS cleans the project it also executes generate<BuildVarian>Sources and generate<BuildVarian>TestSources for all module projects (this is scheduled in such a way that it's always executed before running the actual assemble command)
When running ./gradlew clean assembleDebug from the terminal it seams that gradle doesn't fetch the exported sub module arrs on time. Could be a bug in Gradle 2.2 (2.2.1) or the Android Gradle Plugin - I don't recall having such issues with previous versions
When running ./gradlew clean generateDebugSources generateDebugTestSources assembleDebug the issue is still in place - May be also related to the bug.
Temp solution
Execute the the following commands sequentially:
# ./gradlew clean generate<BuildVariant>Sources generate<BuildVariant>TestSources
# ... task output
# ...
# ./gradlew assemble<BuildVariant>
This way the output apk is assembled with all module projects
Longterm solution
Fired an issue ticket here
Related
Today I updated gradle and kotlin dependencies in android studio.
The new versions are these:
kotlin_version = "1.5.10"
...
jacoco {
toolVersion = "0.8.6"
}
...
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
The test coverage report task fails with the following error:
2021-05-27T16:57:49.150+0200 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':consumerkit:testDebugUnitTestCoverage'.
2021-05-27T16:57:49.304+0200 [DEBUG] [org.codehaus.groovy.vmplugin.VMPluginFactory] Trying to create VM plugin `org.codehaus.groovy.vmplugin.v9.Java9` by checking `java.lang.Module`, but failed:
java.lang.ClassNotFoundException: java.lang.Module
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.groovy.vmplugin.VMPluginFactory.lambda$createPlugin$0(VMPluginFactory.java:61)
at java.security.AccessController.doPrivileged(Native Method)
For Kotlin 1.5 you should use JaCoCo 0.8.7 instead of 0.8.6 - see https://github.com/jacoco/jacoco/pull/1164 and the full changelog at https://www.jacoco.org/jacoco/trunk/doc/changes.html
Example snippet:
// build.gradle or build.gradle.kts
jacoco {
toolVersion = "0.8.7"
}
I already had the
jacoco {
toolVersion = "0.8.7"
}
configured but it was not working anyway, what fixed the problem was to follow this comment here
In your module build.gradle switch back to:
android {
//....
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
don't worry, it won't break anything if you were not using Java 11 language features yet, AGP 7 is still compatible with JDK 8 as target.
Then you need to force AGP to use the 0.8.7 version and not the default 0.8.3 one. In your allprojects block in the root build.gradle file, add this:
allprojects {
//... other things
// workaround to fix an auto-import of a lower Jacoco version
resolutionStrategy {
eachDependency { details ->
if ('org.jacoco' == details.requested.group) {
details.useVersion "0.8.7"
}
}
}
}
and now it should work using:
AGP 7.0.X
Kotlin 1.5.X
JDK 11 (embedded with AS)
Simply doing
jacoco {
toolVersion = "0.8.7"
}
was not enough for me. I also had to override the version that Android was using so that the androidJacocoAnt dependency also uses 0.8.7. (./gradlew app:dependencies) Simply add this to your gradle too
android.jacoco.version = "0.8.7"
It's quite old thread, but these solutions did not solve my problems completely in Android project (actually written in Java - not in Kotlin), so I will add my solutions here. Maybe someone will find it helpful.
Except of updating jacoco toolVersion to 0.8.7, I also had to update execution data in my jacoco config as follows:
project.afterEvaluate {
tasks.create(name: "${unitTestTask}Coverage", type: JacocoReport,
dependsOn: [
"$unitTestTask",
":sdk:testDebugUnitTest",
":sdk:connectedCheck"
]) {
/* all jacoco custom configuration goes here... */
executionData(fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec",
"outputs/code_coverage/debugAndroidTest/connected/*coverage.ec"
]))
}
}
in this configuration I had to add the following line:
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec"
which wasn't there before because file with generated report used by sonar was generated in the new location. Report is generated with gradle task testDebugUnitTestCoverage. After all of that, I'm able to generate test coverage report including connected/instrumentation Android tests and regular unit tests in java via sonar.
I am developing a React Native project and am using a third party library react-native-geolocation-service. Inside the build.gradle file of that library, the version of play-services-location is defined as so: (refer to this link for the entire build.gradle file)
dependencies {
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
implementation "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
}
Inside the build.gradle file of my project, I have the following:
buildscript {
ext {
...
googlePlayServicesVersion = "16.1.0"
}
}
Inside the app/build.gradle file of my project:
dependencies {
implementation(project(':react-native-geolocation-service')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
implementation ('com.google.android.gms:play-services-location:16.0.0') {
force = true
}
}
Even though I have specified in the gradle file to use version 16.0.0 for play-services-location, I still get the following error after I ran gradlew clean then gradlew build:
Execution failed for task ':react-native-geolocation-service:generateDebugRFile'.
Could not resolve all files for configuration ':react-native-geolocation-service:debugRuntimeClasspath'.
Could not find com.google.android.gms:play-services-location:16.1.0.
Why is gradle still looking for version 16.1.0 and not version 16.0.0?
If You are going to check the release notes from Here.
June 17, 2019
The release is
com.google.android.gms:play-services-location:17.0.0
October 2, 2018
The release was
com.google.android.gms:play-services-location:16.0.0
So there was no release Version 16.1.0 for location
I am trying to build and imported Android project in Android Studio/Eclipse.
My goal is to write automated test to the current project. First, I am trying to build the project and then to make an apk file of it so I will be able to execute real device/emulator tests on it.
Here are my available Gradle tasks
There is no build or test or assemble and etc. tasks which are I am looking to use so I will reach my goal.
Here is my project tree and both build.gradle files
`
apply plugin: "java"
repositories {
jcenter()
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.13
testCompile 'junit:junit:4.12'
}
and
apply plugin: 'com.android.application'
version = "1.2"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "sdk.mobfox.com.appcore"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
archivesBaseName = "MobFox-Android-SDK-Client-" + version + ".apk"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize = "4g"
}
lintOptions {
abortOnError false
}
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-ads:11.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.danikula:videocache:2.7.0'
testCompile 'junit:junit:4.12'}
I tried to open the project in Android Studio but got the same state.
I opened a new Gradle project in Eclipse and saw that the tasks I am looking for are available there - I believe because of the 'java-library' plugin which added to the build.gradle root file but I use the same plugin in my root build file and did not receive what I expected.
I was succeeded to execute the Gradle "tasks" which gave me the next response in console :
Working Directory: C:\Users\orit\Desktop\mobFox\MobFox-Android-SDK-master\MobFox-Android-SDK-master
Gradle User Home: C:\Users\orit.gradle
Gradle Distribution: Specific Gradle version 4.1
Gradle Version: 4.1
Java Home: C:\Program Files\Java\jdk1.8.0_91
JVM Arguments: None
Program Arguments: None
Gradle Tasks: tasks
:tasks
All tasks runnable from root project
Build tasks
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
Build Setup tasks
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.
Documentation tasks
javadoc - Generates Javadoc API documentation for the main source code.
Help tasks
buildEnvironment - Displays all buildscript dependencies declared in root project 'MobFox-Android-SDK-master'.
components - Displays the components produced by root project 'MobFox-Android-SDK-master'. [incubating]
dependencies - Displays all dependencies declared in root project 'MobFox-Android-SDK-master'.
dependencyInsight - Displays the insight into a specific dependency in root project 'MobFox-Android-SDK-master'.
dependentComponents - Displays the dependent components of components in root project 'MobFox-Android-SDK-master'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'MobFox-Android-SDK-master'. [incubating]
projects - Displays the sub-projects of root project 'MobFox-Android-SDK-master'.
properties - Displays the properties of root project 'MobFox-Android-SDK-master'.
tasks - Displays the tasks runnable from root project 'MobFox-Android-SDK-master'.
Verification tasks
check - Runs all checks.
test - Runs the unit tests.
Rules
Pattern: clean: Cleans the output files of a task.
Pattern: build: Assembles the artifacts of a configuration.
Pattern: upload: Assembles and uploads the artifacts belonging to a configuration.
To see all tasks and more detail, run gradle tasks --all
To see more detail about a task, run gradle help --task
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
**1. What is the reason I cannot get all the task I got when I open a new project?
How can I add these tasks so I will be able to create apk file, build and execute integration tests?**
task, you write in project level build.gradle file. See below pic for the reference.
You are posting module level build.grale file.
Applying com.android.application should be enough, you should not apply java plugin on the root either and add dependencies there.
Operate on your app project, with Java specific stuff.
For more reference how to structure your project.
https://developer.android.com/studio/build/index.html
I am using libusb in my android application. When I am trying to build libusb native library then I get below error message, *.so files generated.
Error:Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
More than one file was found with OS independent path 'lib/x86/libusb.so'
build.gradle
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.williams.libusbpoc"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
// 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
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.anko:anko-appcompat-v7-commons:$anko_version"
}
I am on windows machine. Does anyone know what could be the issue ?
I was having this issue in my React-Native Bridge project after I added AAR files of 3rd party SDK. And I was linking the Bridge into my Main React-native application.
Solution (May differ for you):
Add this in app/build.gradle the Main React-Native application:
android {
// ...
packagingOptions {
pickFirst '**/*.so'
}
}
Test the Build on React-Native Bridge project after adding the AAR libraries.
Clean the React-Native Bridge project
Clean the React-Native application project
Remove node_modules and re-install the bridge package into the project.
Run the application.
I faced another issue related to this (If you include AAR into library project that's not being linked to main application)
https://stackoverflow.com/a/58588503/3197778
I removed jniLibs.srcDir 'src/main/libs' code inside sourceSets.main block. It was creating *.so files twice.
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
you can use like this:
add the following code into build.gradle ,
packagingOptions {
pickFirst 'lib/armeabi-v7a/your_name.so'
pickFirst 'lib/arm64-v8a/your_name.so'
pickFirst 'lib/x86/your_name.so'
pickFirst 'lib/x86_64/your_name.so'
}
this pickFirst that means : if more than one path matches the first-pick, only the first found will be selected. please click Get more information
In case of react-native
add android/app/build.gradle file into andorid : {.....} section this :
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
then use "gradlew clean"
I've seen a similar error running my app after migration to Android Studio 3.0. A build clean solved the issue.
in my case adding these fixed the issue to build.gradle app level module
packagingOptions {
pickFirst 'lib/armeabi-v7a/libblasV8.so'
pickFirst 'lib/mips/librsjni.so'
pickFirst 'lib/x86/libblasV8.so'
pickFirst 'lib/mips/libRSSupport.so'
pickFirst 'lib/mips/libblasV8.so'
}
but in your case library names could be different so replace them with your library names
I was seeing this error after adding react-native-pdf to my project. FAHID's solution worked for me.
Note that in later versions of Gradle, pickFirst() is deprecated in favor of resources.pickFirsts() or jniLibs.pickFirsts.add().
Manually clean the project. Perform the following in the project directory:
rm -rf .idea .gradle */build */.cxx
rm -rf ~/.gradle
This will clean up all intermediate files and also clear the gradle cache.
I just want to add to Nonos answer that I think I received this issue after running ndk-build within my app/jni directory, and then running ./gradlew installDebug from the top-level directory of my Android NDK project. So doing an ndk-build clean in app/jni before doing another Gradle build did indeed solve the problem.
N Sharma solutions is good.
But in case your conflict is with an external module that you added as a library in your project and you are not able to edit its code as it is readonly you can follow below steps:
I was facing same issue with ffmpeg library after merging two Android projects as one project.
Actually issue was arriving due to two different versions of ffmpeg library but they were loaded with same names in memory. One library was placed in JNiLibs while other was inside another library used as module. I was not able to modify the code of module as it was readonly so I renamed the one used in my own code to ffmpegCamera and loaded it in memory with same name.
System.loadLibrary("ffmpegCamera");
This resolved the issue and now both versions of libraries are loading well as separate name and process id in memory.
faced this issue in react-native "react-native": "0.64.2"
facing this issue because of recent react native updates, old builds are failing
i have done the fallowing to run the build successfully & this solution works after most of the issue caused in recent update.
in android/build.gradle (not the project level) change the followings
add kotlin version in ext of buildScripts {... kotlin_version = '1.6.10'}
in dependecies add the classpath
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
add this line in between ending of buildscript and beginning of allprojects
add this line in the first beginning of all projects
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
If you are using react native version below 0.70.5 then you should implement this,
Add this code in android/build.gradle file
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
// ...
}
}
It worked for me.
If Your gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent. You can use this,
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
I installed Android Studio and when I try to import a project from gradle this resolve error shows up:
Unable to load class
'org.codehaus.groovy.runtime.typehandling.ShortTypeHandling'.
I deleted the files in my Users .gradle folder and tried different gradle versions. I don't know how to fix this.
This page might help solve the problem. What they say is:
So we leveraged this version to add a new artifact, named
groovy-backports-compat23. This artifact shouldn’t be necessary for
most of you, but if you face an error like:
Caused by: java.lang.ClassNotFoundException:
org.codehaus.groovy.runtime.typehandling.ShortTypeHandling at
java.net.URLClassLoader$1.run(URLClassLoader.java:372)
in your project, then it means that a class has been compiled with
Groovy 2.3+ but that you are trying to use it with an older version of
Groovy. By adding this jar on classpath, you give a chance to your
program to run. This may be particularily interesting for Gradle users
that want to use a plugin built on Gradle 2+ on older versions of
Gradle and face this error. Adding the following line to their build
files should help:
buildscript {
// ...
dependencies {
classpath 'some plugin build on gradle 2'
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
} }
Note that for now, this jar only contains the ShortTypeHandlingClass.
Future versions may include more.
- See more at: http://glaforge.appspot.com/article/groovy-2-3-5-out-with-upward-compatibility#sthash.mv7Y8XQv.dpuf
I can fix this error message using these three methods.
use latest gradle version
use latest android SDK and tools.
use proguard-rules.pro
build.gradle (Project:xxxxx)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
mavenCentral()
}
}
build.gradle (Module:app)
apply plugin: 'android'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I had the same problem. I ran gradle from command line and that did work.
After that, I found File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle. There "Use local gradle distribution" was active. Changed it to "Use default gradle wrapper (recommended)" and it worked.
I have had a same problem. And I have found a solution.
Cause
This problem is caused by android gradle plugin does not match for gradle version.
Solution
Edit build.gradle in project. gradle plugin version must be satisfied requirements for android studio.
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
And edit distrubutionUrl in gradle/wrapper/gradle-wrapper.properties. version of gradle must be satisfied requirements for gradle plugin.
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
You can find version compatibilities between android studio, android gradle plugin and gradle in this page
https://stackoverflow.com/a/29695756/3675925