I'm not able to import RecyclerView & CardView although it seems very trivial. This is the relevant part from gradle.build script:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "23.0.0"
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java {
srcDir 'src/main/java'
}
resources {
srcDir 'src/../lib'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.1'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.google.android.gms:play-services:7.8.+'
}
The sync & build tasks executes normally so it seems that the dependencies actually downloaded. And when in some activity I try to import android.support.v7.widget.RecyclerView; it's not recognising the package.
Maybe it's SDK API versions issues? Note I need min 11 and target max 22.
Add recent recyclerview which is in your sdk.
right click on app --> Open Module Settings --> Dependencies
then on right side click on plus button. Add library dependency and search recyclerview and then add it.
Hope it will work.
You need to change the buildToolsVersion. See the below code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:palette-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:support-v4:21.0.3'
compile files('libs/picasso-2.2.2.jar')
compile project(':Cropper')
compile project(':library')
compile project(':quickScroll')
}
Related
that is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mabna.hearthurt"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
// compile 'com.github.traex.rippleeffect:library:+'
// compile 'com.balysv:material-ripple:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.0'
}
but this error occured:
error(32,13) failed to resolve: com.squareup.picasso:picasso:2.5.1
also for:
compile 'com.github.traex.rippleeffect:library:+'
compile 'com.balysv:material-ripple:1.0.2'
and other external dependencies error occured.
i have sample of com.github.traex.rippleeffect:library:+ and com.squareup.picasso:picasso:2.5.1 and other dependencies compiled with no error.
so what is the problem
At First Remove + calling from Gradle
Do
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.android.support:appcompat-v7:23.1.0' // Instead yours
Edit
Call multiDexEnabled true
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Then Clean-Rebuild-Sync in your Project.
Dependencies is a virtual folder where IDE shows what JAR files the
project depends on.
#Solivan I guess it's packaging bug . Whenever you create a new project then this bugs omitted .
The problem I am facing is that my android application works well on devices 4.4.2 and below, but crashes on devices having Lollipop(5.0) and its corresponding higher versions.I know that its somehow related to the build tools in my gradle file,but still not able to figure out the problem.Could someone please help me out with this.
This is my gradle file,
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.vs.vertosys"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter() {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:multidex:1.0.1'
// compile 'com.android.support:appcompat-v4:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:+'
compile 'com.pushwoosh:pushwoosh:+'
}
I can import everything else from the Android library except for those two. I'm trying to import them from android.support.v7.widget which doesn't work, but importing fragment and activity classes from android.support.v4.widget does work.
My Gradle Build looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.frisosapps.planner"
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.2.1'
compile 'com.android.support:support-v4:22.2.1'
}
Should I add something to this or should I look for the cause elsewhere?
To use RecyclerView, use
compile 'com.android.support:recyclerview-v7:23.1.1'
you'll need to include the RecyclerView dependency as its standalone library
compile "com.android.support:recyclerview-v7:23.1.1"
I'm trying to use the method findFirstVisibleItemPosition() from a LinearLayoutManager. The apis show that this method exists, but it is not recognized nor shown in autocompletion.
Other methods from this layout work (some at least), and android.support.v7.widget.LinearLayoutManager is imported.
What could be wrong?
edit: hereĀ“s my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.skate.socialskate"
minSdkVersion 21
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'])
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.android.support:support-v13:22.1.0'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
compile 'org.jsoup:jsoup:1.8.2'
}
You need to add an appcompat to your build.gradle:
compile 'com.android.support:appcompat-v7:22.1.1'
I updated my Android Studio to 1.0.1. I followed this tutorial http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0 and changed from runProguard to minifyEnabled true. I also changed it in my library project. When I tried to compile it gave me Error:Execution failed for task ':> java.io.FileNotFoundException: ProjectName\library\proguard-rules.txt (The system cannot find the file specified). I researched for that and I found a solution. I added blank proguard-rules.txt file into that folder. After trying to compile, it gave me even more errors. The main error now was that it cannot find symbol class PageIndicator, which is my library's class. I don't even know what can I do for that.
My project's build.gradle:
apply plugin: 'android'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.miesto.meniu"
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
compile files('libs/volley.jar')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.0#aar'
compile('com.google.api-client:google-api-client-xml:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'
compile('com.google.api-client:google-api-client-android:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc'
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
My library's build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
}
What am I doing wrong?
I solved this problem when I deleted my library and added it again.