I import project from eclipse to android studio, and got above message after Sync project with gradle files. I am new with android studio, don't know how to solve this error.
Following is the Gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId "com.s5.selfiemonkey1"
minSdkVersion 14
targetSdkVersion 14
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
productFlavors {
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/AF-Android-SDK.jar')
compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
compile files('libs/FlurryAnalytics-5.3.0.jar')
compile files('libs/android-viewbadger.jar')
compile files('libs/commons-codec-1.4.jar')
compile files('libs/google-play-services.jar')
compile files('libs/okhttp-2.5.0.jar')
compile files('libs/okio-1.6.0.jar')
compile files('libs/parcelgen.jar')
compile files('libs/scribe-1.1.2.jar')
}
Build Gradle from 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.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
Please advice. Thanks in advance.
Since GSon is in mavenCentral , you have to add mavenCentral() in buidscripts phase.
Gson's latest version is currently 2.3.1 https://github.com/google/gson/releases
Try with compile 'com.google.code.gson:gson:2.3.1'
you have to add the Gson library in the dependency using project structure, now to update the gradle, for the add the .jar file to your build.gradle file like
dependencies {
compile files('libs/gson-2.2.4.jar')
}
if it dosent works try changing it to
dependencies{
compile 'com.google.code.gson:gson:2.2.+'
}
make sure you are also connected to the internet so that jars will be downloaded online through maven repo.
Related
I know that there is so many question regarding this, but I have tried all solution from StackOverflow but still I did not resolve this issue
my app level build.gradle files is
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.aple.gole.video"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "0.1"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id: "a1bdfc88-fffb-4283-9c45-8a15b3bbd3a2",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:customtabs:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.code.gson:gson:2.7'
compile 'org.jsoup:jsoup:1.8.3'
compile 'org.mozilla:rhino:1.7.7'
compile 'ch.acra:acra:4.9.0'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.nononsenseapps:filepicker:3.0.0'
compile 'com.google.android.exoplayer:exoplayer:r2.4.2'
compile ('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
compile ('com.onesignal:OneSignal:[3.5.3,4.0.0)') {
exclude group: 'com.google.android.gms', module: 'play-services'
}
compile 'com.github.varunest:sparkbutton:1.0.5'
compile 'com.google.firebase:firebase-database:11.0.2'
}
apply plugin: 'com.google.gms.google-services'
I started to get this issue when I used this
apply plugin: 'com.google.gms.google-services'
but it required for firebase
my project level build.gradle is
// 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.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven { url "https://jitpack.io" }
}
}
From External Library I have found different version of Google Play Service
Might be that will crate problem, let me share you screenshot
please click here to check screenshot
but now problem is why there is different version of Google Play Service, One is Play Service iid 10.0.1 and other one is play service task 11.0.2
,How to make it same
Hi I have found that you
compile 'com.google.firebase:firebase-database:11.0.2'
is using
google-play-service lib 11.0.2
You can do this
compile 'com.google.firebase:firebase-database:10.0.1'
so it will use
google-play-service lib 10.0.1
it will work, I have tested
I had this problem after updating com.android.tools.build:gradle from project to 2.3.0-beta1.
If I set back to 2.2.3, the Theme.AppCompat style recognizes.
I don't want to set it to 2.2.3 because the project can't be out of time.
Here is the error's print:
My project's build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
My app's build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.xxxxxxx.xxxxxxx"
minSdkVersion 19
targetSdkVersion 25
versionCode 76
versionName "1.18.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
useLibrary 'org.apache.http.legacy'
}
buildscript {
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
}
repositories {
maven {
url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
}
maven {
url 'https://maven.fabric.io/public'
}
flatDir {
dirs 'libs'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('de.keyboardsurfer.android.widget:crouton:1.8.5#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile(name: 'libctfclient-sdk', ext: 'aar')
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v13:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.github.gabrielemariotti.cards:library:1.8.0'
compile 'com.github.gabrielemariotti.cards:library-extra:1.8.0'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:0.9.9'
compile 'com.embarkmobile:zxing-android-minimal:2.0.0#aar'
compile 'com.embarkmobile:zxing-android-integration:2.0.0#aar'
compile 'com.google.zxing:core:3.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.android.gms:play-services-analytics:9.8.0'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
}
In order of that error, I have this problem:
I already tried:
Invalidate Caches\Restart;
Update android support library to the last version;
Clean and Rebuild the project;
Does anyone know how to solve this problem without setting project's build.gradle to 2.2.3?
As said in this answer https://stackoverflow.com/a/42765120/3825764,
"build cache" is enabled by default in build Android Plugin since 2.3.0. It creates files in build cache outside of project folder (e.g. in \Users\%username%.android\build-cache). Theese files are intended to be common between your projects.
And then Android Studio is unable to navigate in theese files.
You can disable Build Cache in gradle.properties file. just add android.enableBuildCache=false
I used android.tools.build:gradle:2.3.0-beta3 and had the same problem. I've upgraded Android Studio 2.2.3 to 2.3 beta 2 and everything had worked.
File -> Invalidate Caches / Restart did not resolve the issue.
Preferences -> Build, Execution, Deployment -> Gradle showed Use local gradle distribution selected with Gradle home: /Applications/Android Studio.app/Contents/gradle/gradle-2.14.1 and a warning displayed saying the gradle location was incorrect.
Resolved issue by selecting Use default gradle wrapper (recommended).
Probably just pointing to the new local distribution location would also work.
Try: File -> "Invalidate Cashes\Restart"
Can be just problem of android studio
I'm trying to import an android project from bitbucket at my work, as the former android developer quit and I'm to continue his work.
Gradle sync never returns ok. It got the error:
Error:Could not find
com.google.android.gms:play-services-measurement:9.0.0. Required by:
frontend:app:unspecified
funny thing is, I grabbed every occourence of the string "measurement" at the whole git folder and found only one, at module app, build.gradle, and it was commented and not even the version gradle is complaining about:
dependencies {
...
// compile 'com.google.android.gms:play-services-measurement:8.3.0'
...
}
Can someone please help? I would really appriciate it as I'm struggling here for a couple of hours already.
Thx in advance!
the project (named "frontend") build.gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'me.tatarka:gradle-retrolambda:3+'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
the module (named "app") build.gradle:
apply plugin: 'com.android.application' apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.smartbus"
minSdkVersion 17
targetSdkVersion 23
versionCode 29
versionName "2.1.5"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
dexOptions {
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
}
retrolambda {
jdk "C:\\ProgramData\\Oracle\\Java\\javapath\\java.exe"
jvmArgs '-noverify' }
dependencies {
apply plugin: 'android-apt'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
provided "org.projectlombok:lombok:1.16.8"
apt "org.projectlombok:lombok:1.16.8"
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
compile 'com.android.support:design:24.0.0-alpha2'
compile 'com.android.support:cardview-v7:24.0.0-alpha2'
compile 'com.google.guava:guava:18.0'
compile 'org.reflections:reflections:0.9.10'
compile 'com.annimon:stream:1.0.5'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.0-RC1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3'
compile 'com.github.rey5137:material:1.2.2'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.prolificinteractive:material-calendarview:1.1.0'
compile 'com.google.code.gson:gson:2.5'
// compile 'com.google.android.gms:play-services-measurement:8.3.0'
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:+'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
// compile 'com.google.android.gms:play-services-location:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
the whole-error:
Error:A problem occurred configuring project ':app'. Could not resolve
all dependencies for configuration ':app:_debugCompile'. Could not
find com.google.android.gms:play-services-measurement:9.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.jar
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.pom
https://oss.sonatype.org/content/repositories/snapshots/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.jar
file:/C:/Users/Re'em/AppData/Local/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.pom
file:/C:/Users/Re'em/AppData/Local/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.jar
file:/C:/Users/Re'em/AppData/Local/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.pom
file:/C:/Users/Re'em/AppData/Local/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-measurement/9.0.0/play-services-measurement-9.0.0.jar
Required by:
frontend:app:unspecified
Can you change
classpath 'com.google.gms:google-services:2.0.0-alpha3' to the latest version say
classpath 'com.google.gms:google-services:3.0.0'
and check
courtesy user3330522 answer
In my Android application, I want to add Uber facility to users so that I looked the following library. So that I added the compile 'com.uber.sdk:rides-android:0.1.0' in my main module's (Main application) build.gradle file. It gives me following error when sync the gradele
Failed to resolve: com.uber.sdk:rides-android:0.1.0
I have some other libraries referenced to the application.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/UserFormValidation.jar')
}
Please help me to resolve this exception.
Try to add this in your gradle file
repositories{
maven { url "https://jitpack.io" }
}
In the portion of your build.gradle file that you have included you only have the mavenCentral() repository specified within the buildScript block. In order to make that repository accessible outside of that context you should include a block such as the following to the root level of your build.gradle:
repositories {
mavenCentral()
}
In addition, you have not actually included the line compile 'com.uber.sdk:rides-android:0.1.0' in the file copied in your question.
Ultimately, your build.gradle should include the following:
repositories {
mavenCentral()
}
dependencies {
compile 'com.uber.sdk:rides-android:0.1.0'
}
this SDK is designed to work with Android SDK 16. so minSdkVersion should be 16 or greater
Referring question here.
Problem is that i am including something which is repeated.
Can somebody help me figure which one is causing problem?
And this error started arising when i added twitter sdk.
build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.sony.login_signup"
minSdkVersion 15
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'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.shamanland:facebook-like-button:0.1.8'
compile 'com.google.android.gms:play-services:+'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile('com.twitter.sdk.android:twitter:1.9.0#aar') {
transitive = true;
}
}
If you do:
gradle -q dependencies
It should output a tree of all gradle dependencies and their dependencies. If you trace the dependency tree you will find which ones are using support-v4 and their versions, to tell you where the problem is.
EDIT:
This should be run on a command line / terminal. Gradle is just another program...
https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html
To do this, make sure that "gradle" is in your environment PATH (this is different depending on if you're Windows or Mac, but if you search you will find it).
Then run the command from the folder where your "build.gradle" and "settings.gradle" files are located (your project "root" folder typically).