Android studio not recognizing a method? - android

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'

Related

Failed to resolved: compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "org.passitonkentucky.fayetteresources"
minSdkVersion 18
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.android.support:multidex:1.0.2'
}
I downloaded Android 3.0.1, before this I had error minimum version 3.0.
When that's resolved, it's now showing me error.
(27,4).
How can I solve this problem?
First you should avoid using "+" in version number its bad practice. add version number will solve your problem.
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'

Android RatingBar Style Small showing error in Android studio

I am using RatingBar in android and want to reduce the size of it , so I added
style="?android:attr/ratingBarStyleSmall"
as Ratting Bar Style attribute. It is working fine but it is showing error in code
below is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion " 22.0.1"
defaultConfig {
applicationId "com.app.xxxx"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(path: ':vitamio')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
}
Please help what I am doing wrong..
Thanks In Advance..
Use this instead style="?attr/ratingBarStyleSmall"

Failed to resolve--compile 'com.android.firebase:firebase-storage:9.0.0'

I am facing this error:
Failed to resolve--compile 'com.android.firebase:firebase-storage:9.0.0'
Here is the app gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.kartik.barcode"
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.0.2#aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.android.support:design:23.2.1'//for The edittext animation
compile 'com.google.firebase:firebase-database:9.0.0'//for firebase
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.android.firebase:firebase-storage:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
Here is the SDK Tool Tab
Change:
compile 'com.android.firebase:firebase-storage:9.0.0'
to:
compile 'com.google.firebase:firebase-storage:9.0.0'

No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'. on adding third party library

So I am getting this error when I add this library in my gradle file.
compile 'com.miguelcatalan:materialsearchview:1.4.0'
This is my gradle file
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.gnr.kumar.varun.songapp.songapp"
minSdkVersion 16
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.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
}
How can I prevent this, can anyone please suggest something ?
'android:TextAppearance.Material.Widget.Button.Inverse'
You should change your compileSdkVersion
compileSdkVersion 23 // compileSdkVersion is the version of the compiler used in building the app
buildToolsVersion "23.0.1"
Then Clean-Rebuild-Sync Your App .

Retrofit class not found exception after adding project module to my project in android Studio

Am new to retrofit, I have used retrofit in my project which was working fine upto now for all version of my required devices. but after adding a library module to my project it runs on only higher versions like 22 v and prompts an error this:
Could not find class 'retrofit.Utils$SynchronousExecutor', referenced
from method retrofit.RestAdapter$Builder.setExecutors
java.lang.NoClassDefFoundError: retrofit.RestAdapter$LogLevel
on lower versions like 14 v .
my app gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.risingkashmir"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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:22.0.0'
//noinspection GradleDependency
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.nineoldandroids:library:2.4.0'
compile project(':library')
compile files('libs/universal-image-loader-1.9.4.jar')
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile project(':librarymenu')
}
and my library Gradle is:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "v0.1L"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// compile 'com.balysv:material-ripple:1.+'
// compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:appcompat-v7:23.2.0'
}

Categories

Resources