I'm following the guide http://tools.android.com/tech-docs/new-build-system/gradle-experimental to update my gradle configuration in order to use ndk.
Pluggin version: 0.6.0-alpha5
Gradle version: 2.10
After the changes, I get the error:
Gradle sync failed: Cause: com.android.build.gradle.managed.AndroidConfig$Impl
Here is my build.gradle. Did I forgot something or made a mistake ?
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.appid"
minSdkVersion.apiLevel 19
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles.add(file('proguard-android.txt'))
proguardFiles.add(file('proguard-rules.pro'))
}
}
ndk {
moduleName "ImageProc"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
// JSON serialization
compile 'com.google.code.gson:gson:2.4'
// Network
compile 'com.squareup.retrofit:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
// Junit
testCompile 'org.robolectric:robolectric:3.0'
}
I believe that buildTypes should be outside the "android" block. Also, possibly replace "defaultConfig" with "defaultConfig.with" I followed build.gradle structure in this answer. Then Gradle finally was able to build.
Maybe this will help.
My working file for:
Android Studio: 3.0.1
with:
classpath 'com.android.tools.build:gradle-experimental:0.11.1'
looks like this:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.niedved.xxx"
minSdkVersion.apiLevel 19
targetSdkVersion.apiLevel 22
ndk {
moduleName "mupdf"
}
multiDexEnabled true
jackOptions {
enabled true
}
}
buildTypes {
release {
jackOptions {
enabled true
}
minifyEnabled false
proguardFiles.add(file("proguard-rules.pro"))
}
}
productFlavors {
}
compileOptions.with {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
dependencies {
compile project(':main')
compile 'com.android.support:multidex:1.0.2'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
compile 'com.google.code.gson:gson:2.6'
compile files('libs/devsmartlib.jar')
compile files('libs/ormlite-core-4.48.jar')
compile files('libs/ormlite-android-4.48.jar')
compile files('libs/retrofit-1.7.1.jar')
compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-maps:11.6.2'
compile 'com.google.android.gms:play-services:11.6.2'
}
Related
I am trying to import some libraries like Picasso, etc. but Android Studio shows up with this message.
here is the build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.mypc.urumcafe"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.volley:volley:1.0.0'
compile 'com.amitshekhar.android:android-networking:1.0.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
I just want to import 'com.amitshekhar.android:android-networking:1.0.1'but as you can see in the uploaded image there is "failed to resolve" error.
so how can I fix this? the same story is for Picasso lib.
Thank you.
Update your build tools version to 27.0.3 and corresponding dependencies to sdk version 27.
here is the updated build.gradle and it is working perfectly.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.mypc.urumcafe"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.android.support.constraint:constraint-layout:2.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.amitshekhar.android:android-networking:1.0.1'
compile 'com.android.support:design:27.1.1'
testCompile 'junit:junit:4.12'
}
The newest version of the library is 1.0.2.
Use this and try again:
com.amitshekhar.android:android-networking:1.0.2
you might be lacking the Maven Central (or the jitpack.io for v1.0.2) repository:
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
Below is my app.gradle apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.crayond.vlearning"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
jackOptions {
enabled true
}
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
incremental false
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':recyclerview')
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.github.Kunzisoft:Android-SwitchDateTimePicker:1.5'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.yalantis:phoenix:1.2.3'
testCompile 'junit:junit:4.12'
/* compile 'com.google.dagger:dagger:2.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'*/
annotationProcessor 'org.androidannotations:androidannotations:4.1.0'
compile 'org.androidannotations:androidannotations-api:4.1.0'
}
I get the following error while syncing gradle:
Error:Could not get unknown property 'classpath' for task ':app:transformJackWithJackForDebug' of type com.android.build.gradle.internal.pipeline.TransformTask.
To update your android project jdk version to 1.8 use retrolambda library.
In your app level build.gradle file add:
1.
apply plugin: 'me.tatarka.retrolambda' in the top of the file.
2.
android{
//Other stuff
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
3. And then add new dependency to your project level build.gradle file.
dependencies {
//Other dependencies
classpath 'me.tatarka:gradle-retrolambda:3.4.0'
}
Voila! Now you are able to use java 1.8 features in your android project.
I am trying to add the firebase admin SDK to my project following the instructions here: https://firebase.google.com/docs/admin/setup
but when i add compile 'com.google.firebase:firebase-admin:4.0.4' on my build.grandle file, then following error appears:
Error:(44, 0) Version: 4.0.4 is lower than the minimum version (9.0.0) required for google-services plugin.
If i try version 4.0.3 i face the same problem.
My build.grandle file at the moment:
android {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.qrcodereader"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// compile 'com.google.android.gms:play-services-appindexing:9.0.0'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.zxing:core:3.2.1'
compile 'com.google.firebase:firebase-admin:4.0.4'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.android.support:gridlayout-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui:1.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile project(':linkedin-sdk')
testCompile 'junit:junit:4.12'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
apply plugin: 'com.google.gms.google-services'
Any help appreciated :)
getting the error "Error:Execution failed for task ':app:transformClassesWithDexForLegacyDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException"
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
// needed for okHttp from 23sdk. https://medium.com/android-news/android-networking-i-okhttp-volley-and-gson-72004efff196#.gsfpn3ez8
useLibrary 'org.apache.http.legacy'
dexOptions {
javaMaxHeapSize "3g"
}
defaultConfig {
applicationId "bf.io.openshop"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
multiDexEnabled true
debuggable true
versionNameSuffix '-DEBUG'
}
release {
minifyEnabled false
debuggable true
}
}
testOptions {
unitTests.returnDefaultValues = true
}
productFlavors {
Modern {
minSdkVersion 23
}
Legacy {
minSdkVersion 15
}
}
sourceSets {
androidTest {
resources.srcDirs += ['src/androidTest/resources']
}
}
}
task clearData(type: Exec) {
def clearDataCommand = ['adb', 'shell', 'pm', 'clear', 'bf.io.openshop']
commandLine clearDataCommand
}
repositories { mavenCentral() }
dependencies {
// if needed jar libraries, add them to libs folder and load them here:
// compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.jakewharton.timber:timber:4.1.2'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'mbanje.kurt:fabbutton:1.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
compile 'com.android.support:multidex:1.0.0'
//// Unit testing dependencies
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-all:1.10.19'
// Set this dependency if you want to use the Hamcrest matcher library
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.powermock:powermock-module-junit4:1.6.4'
testCompile 'org.powermock:powermock-api-mockito:1.6.4'
//// Instrumentation test dependencies
androidTestCompile 'com.android.support:support-annotations:23.4.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2.2'
}
apply plugin: 'com.google.gms.google-services'
you can try to clean your project ,rebuild it .It maybe ok.
1.Try to clear cache and rebuild
At path file>clearcache>clear cache and restart
Add multidex support in app level gradle
multudex true inside defaultConfig like this
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
multiDexEnabled true
}
I have this error when I try to run my application.
Build is ok. Run makes errors.I tried to set multiDexEnable to true also butI still get the error..
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "it.prova.mine"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
//mavenLocal()
mavenCentral()
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//bug cardview
//vedi -> http://stackoverflow.com/questions/24455867/error-when- adding-cardview-to-layout
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
//Custom ProgressDialog
compile 'com.github.d-max:spots-dialog:0.4#aar'
//Url Encoder
compile 'org.droidparts:droidparts:2.9.1'
//SearchView
compile 'com.miguelcatalan:materialsearchview:1.3.1'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
//jackson-jsog extension
compile 'com.voodoodyne.jackson.jsog:jackson-jsog:1.1'
//
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.2'
compile 'com.google.code.gson:gson:2.6.2'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
//java.time backport
compile 'org.threeten:threetenbp:1.3.1'
//java.ws.rs.core
compile 'javax.ws.rs:jsr311-api:0.11'
//javax.xml.bind
compile 'javax.xml.bind:jaxb-api:2.1'
//javax.persistence
compile 'javax.persistence:persistence-api:1.0.2'
compile 'commons-codec:commons-codec:1.2'
//javax.json
compile 'org.glassfish:javax.json:1.0.4'
//jackson jsr310 plugin backport java7
compile 'com.github.joschi.jackson:jackson-datatype-threetenbp:2.4.4'
}
And this is the error:
Error
How can I do?
Thanks in advance