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
Related
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'
I've been using the android.support.v7.widget package -- specifically the RecyclerView class (among others but this is where the problem is).
It was working fine until earlier today it randomly seems to default to an earlier version of the package now. I say that because:
When I try calling myRecyclerView.addOnScrollListener(myScrollListener), myRecyclerView.getChildAdapterPosition(myView) etc Android Studio gives the compile error Cannot resolve method ....
If I change it to myRecyclerView.setOnScrollListener(myScrollListener) (ie use set instead of add), it works fine and does not show the deprecated error, which it should because the method is deprecated.
I don't know why it's showing errors now when I've been using and have been able to compile with these methods earlier -- it seems as though it's using an earlier version of android.support.v7.widget library but I have no idea why it would or how to fix it...
edit: my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.myapp.app"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
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 'com.android.support:support-v4:21.0.3'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.github.castorflex.smoothprogressbar:library-circular:1.0.1'
compile 'com.github.rey5137:material:1.1.1'
compile 'com.android.support:design:22.2.0'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.rengwuxian.materialedittext:library:2.1.3'
}
I am not sure, How are you able to import it, But if you want to use RecyclerView, you need to add its dependency, i.e. compile 'com.android.support:recyclerview-v7:22.2.0'
I don't see if you have added RecyclerView dependency to your gradle script. Also, keep in mind, it doesn't come with appcompat package.
Here is my build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.chattr.chattr"
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:appcompat-v7:+'
compile 'com.parse.bolts:bolts-android:1.+'
for some reason, I cannot compile my app for a release version, or any other version for that matter. In other posts, people say that I have a duplicate library being compiled but I cannot see the duplicate anywhere here. Any help would be appreciated
I am assuming you are using the Parse API.
You need to modify your dependencies in gradle file to make
sure that only Parse and sinch will be included .
dependencies {
compile fileTree(dir: 'libs', include: ['Parse-*.jar','sinch*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.parse.bolts:bolts-android:1.+'
}
If you have duplicate library being compiled,maybe it's because your dependent library has contained the jar which is 'com.android.support:appcompat-v7:+' or
'com.parse.bolts:bolts-android:1.+'.
you should check settings.grade,look at something like this "include ':library', ':samples'".check whether the library contains the jar.
hope it's useful to you
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 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.