I am using BetterSpinner in my app.
I have simply included it like that:
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
When I try to use it Android Studio even does not suggest to import the library and marks BetterSpinner red:
The code:
BetterSpinner textView = (BetterSpinner)
findViewById(R.id.registration_spinner_stufe);
textView.setAdapter(adapter);
Where is the mistake that Android Studio does not import the BetterSpinner library into my Fragment class?
The solution
"File" -> "Invalidate Caches..." -> "Invalidate and Restart"
did not work for me..
import com.weiwangcn.betterspinner.library.BetterSpinner;
import com.weiwangcn.betterspinner.library.material.MaterialBetterSpinner;
Was ignored by Android Studio:
My complete grade file:
[app]
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.example.jublikon"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main { res.srcDirs = ['src/main/res', 'src/main/res/drawable/ic_action_search.png'] }
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//Google Libraries
compile 'com.android.support:appcompat-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
compile 'com.github.rey5137:material:1.2.1.6-SNAPSHOT'
compile 'com.github.paolorotolo:appintro:3.3.0'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
}
[project]
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
mavenCentral()
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
Related
i'm trying to import clarifai api in my android project but it gives the following error :
Error:(28, 13) Failed to resolve: com.clarifai.clarifai-api2:android:2.0.2
project.gradle:
// 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
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "ir.codinglab.objectrecognizer"
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'
}
}
lintOptions {
lintConfig rootProject.file('gradle/lint.xml')
}
}
dependencies {
compile 'com.github.markushi:circlebutton:1.1'
compile 'com.clarifai.clarifai-api2:android:2.0.2'
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'
})
testCompile 'junit:junit:4.12'
}
I have to note that i don't have any problems with importing other libraries .
Thank you in advance.
the library you have entered is wrong. This is the correct one -
compile 'com.clarifai.clarifai-api2:core:2.2.3'
I have been trying for hours now to enable data binding in Android. Here is my gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
classpath "com.android.databinding:dataBinder:1.0-rc0"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
android {
compileSdkVersion 16
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "ts.kiosk.app.checkout"
minSdkVersion 16
targetSdkVersion 16
versionCode 2
versionName "0.0.2.258"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
sourceSets {
androidTest.setRoot('src/test')
}
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:20.0.0'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'net.danlew:android.joda:2.7.2'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile project(':asterixmodule')
compile project(':servicemodule')
compile project(':sdfclient')
// Robolectric
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3' // fixes issue on linux/mac
testCompile 'org.robolectric:robolectric:3.0'
}
I keep getting the error:
Error:Could not find com.android.databindig:databinder:1.0.-rc1 .
I have also read similar posts on SO stating that you also have to add:
classpath 'com.android.tools.build:gradle:1.3.0-beta1'
but my gradle is 2.4 so I'm thinking I don't need that and of course if I do add that statement, gradle cannot find that version of gradle (1.3.0)
I upgraded to version 2.0 of Android Studio and the gradle build issue went away
remove
classpath "com.android.databinding:dataBinder:1.0-rc0"
Starting with android gradle plugin 1.5.0, all you need is
android {
dataBinding.enabled = true
}
check your gradle version, i resolved it by upgrading :
previously :
classpath "com.android.tools.build:gradle:1.3.0"
I updated to :
classpath "com.android.tools.build:gradle:2.2.0"
Or 1.5.0 and newer.
I want to add SimpleCropView to my Android Project from Github https://github.com/IsseiAoki/SimpleCropView but dont know how to proceed.My Project Gradle file are as follows.
Project Gradle:
// 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'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Module Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "loginscreen.example.com.girviapp"
minSdkVersion 12
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:design:22.2.0'
compile files('libs/dropbox-android-sdk-1.6.3/dropbox-android-sdk-1.6.3.jar')
compile files('libs/dropbox-android-sdk-1.6.3/json_simple-1.1.jar')
compile files('libs/jcifs-1.3.18.jar')
}
Include the following dependency in your build.gradle file.
dependencies {
compile 'com.isseiaoki:simplecropview:1.0.8'
}
I'm on a android project and I need import the ActionBar-PullToRefresh library, so I import the library with gradle like following:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.android.support:appcompat-v7:20.0.0') {
force = true
}
compile('com.android.support:support-v4:20.0.0') {
force = true
}
repositories {
mavenCentral()
}
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
}
Then I Sync Project with Gradle Files, so I can use the PullToRefreshLayout in my layout xml file.But when I use the library's class in my Fragment code,I can't get nothing code trigger. When I spell the whole class name PullToRefreshLayout the Android studio will not import the class automatically. So what's the problem.
The next two file is my build.gradle file in the root directory and my app directory:
build.gradle file in the root directory
// 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:0.12.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
build.gradle file in the app directory
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ifeve.ifeveforandroid"
minSdkVersion 10
targetSdkVersion 19
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:appcompat-v7:20.0.0') {
force = true
}
compile('com.android.support:support-v4:20.0.0') {
force = true
}
repositories {
mavenCentral()
}
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abc:+'
}
Try importing library this way, add in dependencies section this line:
compile 'com.github.chrisbanes.actionbarpulltorefresh:library:0.9.9'
I'm trying to add both Showcaseview by amlcurran and Android-DirectoryChooser by passy to my android app from MavenCentral, but I keep getting this error for both libraries:
Error:net.rdrei.android.dirchooser:library:2.0
This is my Project Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
This is the inner one:
apply plugin: 'android'
android {
lintOptions {
checkReleaseBuilds false
}
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 6
versionName "1.2.2"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'org.jaudiotagger:jaudiotagger:2.0.1#jar'
compile 'com.android.support:support-v4:19.1.0'
compile 'net.rdrei.android.dirchooser:library:2.0#aar'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
How can I fix it?
The problem is that you are not specifying the repository URL. Check my answer here:
https://stackoverflow.com/a/23879736/570612