I am working on android studio from one year But i can't face this type of problem. What i am doing is adding a dependency of support library in app build.gradle and then sync the project.
Gradle build running is started in background and then after some time studio is automatically crashed. There is no error or logs are found for crashes. And if I removed the dependency from gradle it works properly. I also restarted the machine and having an latest update of studio but it can't fixed the problem. Thanks in advance for any help.
Here is my app level build.gradle file. I am adding compile 'com.android.support:design:22.2.0' library in my project
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId ""
minSdkVersion 16
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.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.isseiaoki:simplecropview:1.0.9'
compile "com.mixpanel.android:mixpanel-android:4.8.0"
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.10.1'
}
apply plugin: 'com.google.gms.google-services'
Related
i am adding that library but can not run my code
dependencies {
compile 'com.google.http-client:google-http-client-gson:1.20.0'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/google-api-client-1.14.1-beta.jar')
compile files('libs/google-api-client-android-1.14.1-beta.jar')
compile files('libs/google-api-services-drive-v2-rev70-1.14.1-beta.jar')
compile files('libs/google-http-client-1.14.1-beta.jar')
compile files('libs/google-http-client-android-1.14.1-beta.jar')
compile files('libs/google-oauth-client-1.14.1-beta.jar')
compile files('libs/google-play-services.jar')
compile files('libs/jsr305-1.3.9.jar')
}
Same type (Old-New version) compile library causes this problem .
The Android plugin for Gradle available in Android SDK Build Tools 21.1 and higher supports multidex as part of your build configuration. Make sure you update the Android SDK Build Tools tools and the Android Support Repository to the latest version using the SDK Manager before attempting to configure your app for multidex.
Setting up your app development project to use a multidex configuration requires that you make a few modifications to your app development project. In particular you need to perform the following steps:
Change your Gradle build configuration to enable multidex
Modify your manifest to reference the MultiDexApplication class
Modify your app Gradle build file configuration to include the support library and enable multidex output .
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
My advise
Use
compile 'com.google.android.gms:play-services:8.3.0'
avoid
compile files('libs/google-play-services.jar')
I guess problem is here
compile files('libs/google-api-client-1.14.1-beta.jar')
compile files('libs/google-api-client-android-1.14.1-beta.jar')
After Edit
apply plugin: 'android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.android.notepad"
minSdkVersion 16
targetSdkVersion 19
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.http-client:google-http-client-gson:1.20.0'
/* compile 'com.google.code.gson:gson:2.3'*/
compile files('libs/google-api-client-1.14.1-beta.jar')
compile files('libs/google-api-client-android-1.14.1-beta.jar')
compile files('libs/google-api-services-drive-v2-rev70-1.14.1-beta.jar')
/*compile files('libs/google-http-client-1.14.1-beta.jar')*/
compile files('libs/google-http-client-android-1.14.1-beta.jar')
compile files('libs/google-oauth-client-1.14.1-beta.jar')
/* compile files('libs/google-play-services.jar')*/
compile 'com.google.android.gms:play-services:5.0.89'
compile files('libs/jsr305-1.3.9.jar')
compile 'com.android.support:multidex:1.0.0'
}
this error is common for older version...
use this code gradle
defaultConfig {
applicationId "your package name"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
//Enabling mutidex
multiDexEnabled true
}
After enabling multidex use this library in dependence
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:multidex:1.0.1'
}
I think it works perfect..
I was working on a project and updated the Android Studio to 1.5 beta. Also I installed android sdks 22 and 23 via SDK manager. After restart the Gradle is failing to refresh without giving any error details.
Here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.company.projname"
minSdkVersion 14
targetSdkVersion 22
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:22.0.3'
compile 'com.android.support:cardview-v7:22.0.2'
compile 'com.android.support:design:22.2.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.sothree.slidinguppanel:library:3.2.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.code.gson:gson:2.3.1'
}
Whats wrong with this?
Edit: Android Studio Version details
Thanks.
I am going to add material-dialogs library to my project but I get this error Error:Failed to find: com.android.support:appcompat-v7:21.0.3 This is build.gradle..Where is my mistake?Is sth wrong with my project?
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.peomtime.tosca.peomtime"
minSdkVersion 15
targetSdkVersion 21
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:support-v4:21.0.2'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'de.hdodenhof:circleimageview:1.2.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
//Core
compile 'com.github.gabrielemariotti.cards:cardslib-core:2.0.1'
compile 'com.github.machinarius:preferencefragment:0.1.1'
//compile 'com.github.nirhart:parallaxscroll:1.0'
compile project(':Parallax')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.afollestad:material-dialogs:0.6.3.1'
}
thank you so much for your help
Check that you have latest libraries installed in Android SDK Manager. For appcompat-v7:21.0.3, the packages need to be checked/updated are:
Android Support Repository
Android Support Library
Also, it's recommended to fix your dependencies version rather than using + to get latest version:
compile 'com.android.support:appcompat-v7:21.0.3'
Not sure why, but I added this repo from Afollestad to my build.gradle (project, not model) and everything was resolved.
repositories {
maven { url "https://jitpack.io" }
}
link
I am trying to import RxAndroid to Android Studio 1.0.2. As soon as I import project from Gradle using default gradle wrapper, I face with following error:
Is there anyone who know the reason?
I just put compile 'io.reactivex:rxandroid:0.24.0' in the gradle dependencies and it works fine.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'io.reactivex:rxandroid:0.24.0'
}
your build.gradle file under the app should be some like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.map_ex"
minSdkVersion 16
targetSdkVersion 21
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:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'io.reactivex:rxandroid:0.24.0'
}
and then you can use classes from RxAndroid
AndroidStudio is a special version of IntelliJ IDEA tailored to work withandroid-gradle-plugin. AndroidStudio is supposed to be used for building android apps and android libraries.
RxAndroid is java library project built with Nebula's gradle-rxjava-project-plugin which is not compatible with android-gradle-plugin. Therefore can't be opened at AndroidStudio. You can use IntelliJ for now.
See for reference: https://github.com/ReactiveX/RxAndroid/pull/81 , https://github.com/ReactiveX/RxAndroid/issues/74
I try to add this lib (https://github.com/daimajia/AndroidImageSlider) to my project. I added the compile library in my gradle file, but i get an error :
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.pp.myapp"
minSdkVersion 16
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.nostra13.universalimageloader:universal-image-loader:1.9.2'
compile 'com.iangclifton.android:floatlabel:1.0'
compile 'com.google.android.gms:play-services:5.0.89'
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.0.9#aar'
}
And i get this error :
Error:Module version com.android.support:support-v13:13.0.0 depends on libraries but is not a library itself
Try adding this dependency:
compile 'com.android.support:support-v13:19.0.+'
You have to install the Android Support Library from the SDK, too.
I got the same error with an oauth library. It was fixed after a while when, tired of implementing new changes to the build.gradle like changing the support libraries, I discarded the changes on the file (via Sourcetree). It synchronized and automatically got fixed.
(Android Studio) It's a kind of magic.