I'm having an annoying problem trying to integrate Android gradle with Jenkins Android Emulator Plugin.
I set those properties to my Android Emulator:
Android OS version: android-18
Screen density: 160
Screen resolution: HVGA
Device locale: es_ES
Target ABI: armeabi-v7a
Emulator name suffix: android18
When I start the process, the emulator starts propertly, but I get the following error:
[Gradle] - Launching build.
[workspace] $ /var/lib/jenkins/jobs/properati-android/workspace/gradlew clean assemble
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:20.0.0.
Required by:
workspace:app:unspecified
In Gradle plugin settings (on Jenkins as a command line Task) I'm using gradlew clean assemble command to build
The following are the build.gradle files I'm currently using in my project.
1) Main gradle file
projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
2) Project Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 9
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.0.0'
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.+'
}
}
repositories {
mavenCentral()
}
apply plugin: 'android'
apply plugin: 'newrelic'
dependencies {
compile 'com.newrelic.agent.android:android-agent:3.+'
}
I would appreciate any help or tip you could share. Thanks in advance!
UPDATE & Solution:
I solved this issue by adding AndroidSupportV4.jar to my libs folder and changing my build.gradle file to the following:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:support-v4:20.0.0' --OLD LINE
compile files ("libs/AndroidSupportV4.jar") --NEW LINE
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}
Related
I'm trying to re-install Android Studio 2.2 in my formatted computer. I tried installing 2.3 updated version but I got these same errors. So I tried installing 2.2 . When I open a project with an empty activity, Gradle sync fails showing errors in the Message section, as shown in the image. The code in build.gradle (module:app) is given as: `
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.heenamehta.myapplication"
minSdkVersion 15
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.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
`
The code in build.gradle (module: project is given as:)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
How can I solve this problem?Messages section Image
Try this :
In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Uncheck the 'Offline work' under 'Global Gradle settings'
Connect the internet and sync.
Update android gradle plugin to latest version
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
I updated my android studio and my gradle will not sync
issues it gives me these errors. Im also using firebase as for authorization and database.I have tried deleting the gradle files and rebuilding but that didnt work. any suggestions would be appreciated.
Failed to resolve .com.android.support:support-v4:25.2.0
Failed to resolve com.android.support.test.espresso:espresso-core:2.2.2
Failed to resolve com.android.support:appcompat-v4:25.3.1
Failed to resolve com.android.support:mediarouter-V7:25.2.0
here is the build gradle for the project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
here is my app gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "com.example.dude.sportspicks518"
minSdkVersion 19
targetSdkVersion 24
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-v4:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:10.2.6'
}
apply plugin: 'com.google.gms.google-services'
several way to try
Invalidate Cache/Restart AS
Clean Project and Rebuild
Update "Google Repository" and "Android Support repository" in the Android SDK Manager.
if not working, then If you are trying to get the support repository, this is the correct import:
compile "com.android.support:support-v4:25.3.1"
If your compile api isn't 25, change the version to the latest with your compile api.
Android Studio should give you a yellow warning if you are using incompatible version. just hover it and use the suggestion given
P/s: Please please dont use com.google.android.gms:play-services.. it very heavy dex method count
I tried to add the following library as a dependency in my android project:
compile 'com.thehayro:infiniteviewpager:0.4'
which gives me the following gradle error when I build:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.google.android:support-v4:r13.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.pom
https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.jar
https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.pom
https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.jar
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
Required by:
xkcdexplain:app:unspecified
xkcdexplain:app:unspecified > com.thehayro:infiniteviewpager:0.4
I tried manually adding the android support library and installing it with the android sdk manager but neither of those things worked.
I also read somewhere that I could try to find a download for the library and manually add it but there must be a more elegant way then that.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.henrykvdb.xkcdexplain"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'org.jsoup:jsoup:1.10.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.thehayro:infiniteviewpager:0.4'
}
global/top-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have downloaded me friends android project. When I open it with android studio it starts to sync gradle. However it gives to me invalid argument error.
My build.gradle file:
buildscript {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'http://audiobox.keytwo.net' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "kz.itsolutions.businformator"
minSdkVersion 19
targetSdkVersion 23
versionCode 20150105
versionName "1.95"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'org.osmdroid:osmdroid-android:4.2'
compile 'org.slf4j:slf4j-simple:1.6.1'
compile 'com.parse.bolts:bolts-android:1.2.0'
compile files('libs/Parse-*.jar')
compile 'com.android.support:support-v4: 22.1.1'
}
I think the main problen is the compileSdkVersion, buildToolsVersion, midsdkVersion and targetSdkVersion. I have installed all avilable sdk versions and changed these numbers, stil does not work.
I think this project uses outdated gradle version which had different argument for something.
What needed to change to make project able to build?
Stack trace of my gradle is:
Gradle 'bus_informator' project refresh failed
Error:Error:Invalid argument
I have tried to find similar questions, but I haven't found.
I have run gradlew assemble --info and it gave me that kind of error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.crashlytics.sdk.android:crashlytics:1.7.0.
Searched in the following locations:
http://dl.bintray.com/populov/maven/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
http://dl.bintray.com/populov/maven/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
https://maven.fabric.io/public/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
https://maven.fabric.io/public/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
http://audiobox.keytwo.net/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
http://audiobox.keytwo.net/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
Required by:
bus_informator:app:unspecified
I fixed this problem by changing this
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/*.jar')
to this
compile fileTree(dir: 'libs', include: ['*.jar'])
This is de build.gradle of app module:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 10
targetSdkVersion 22
versionCode 19
versionName "1.6.2"
}
buildTypes {
release {
minifyEnabled false
debuggable false;
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
repositories {
maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.google.android.gms:play-services:7.5.0"
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'net.glxn.qrgen:android:2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'de.madcyph3r:materialDrawer:1.1.1#aar'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.zxing:core:3.2.0'
compile 'me.dm7.barcodescanner:zxing:1.7'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'org.apache.commons:commons-io:1.3.2'
compile files('libs/GraphView-4.0.1.jar')
compile files('libs/mpandroidchartlibrary-2-1-0.jar')
compile files('libs/bitcoinj-core-0.12.3-bundled.jar')
}
And this is build.gradle of project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.google.gms:google-services:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I'm trying use Google cloud Messaging , I have followed all steps in https://developers.google.com/cloud-messaging/android/client but when I synchronize gradle files with the project I get this:
Failed to complete gradle execution. Cause: [empty]
I tried implement this solution: Android Studio: failed to complete gradle execution, cause is empty and other similar solutions but result is same.
What could be the solution to this problem? Someone has happened this?
Thaanks in advance!!
I found the solution:
The problem lies not in GCM. The problem arises when I try to compile the app. I used the command;
gradlew assembleDebug --stacktrace
and I threw this error:
Unable to execute dex : method ID not in [0 , 0xFFFF ] : 65536.
I've solved with the steps described Google here:
Building Apps with Over 65K Methods