I know this question was asked several times, but none of the answers helped me so far...
All I did was generating a preferences screen with Android Studio and now it tells me that NavUtils cannot be found. Even though my build.gradle looks right (I guess):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.brobox.getyourshitdone"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:support-v4:20.0.+'
compile files('libs/android-support-v4.jar')
}
I hope someone can help :/
Edit:
Just created a new project on my laptop and generated the SettingsActivity again. This is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.brobox.getyourshitdone"
minSdkVersion 14
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:support-v13:20.0.0'
compile 'com.android.support:support-v4:20.0.0'
}
Still got the same error <.<
You have to remove this line implementation files('libs/android-support-v4.jar') and you have to remove this file.
The support library should only be added by gradle. And you have done that in this line implementation 'com.android.support:support-v4:20.0.+'.
YourtargetSdkVersion and your compileSdkVersion are also weird. Those values are not supported with the L developer preview.
compileSdkversionshould be 'android-L', targetSdkVersion should be 'L'.
Press this button, and clean rebuild project.
And add to dependencies :
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:palette-v7:+'
}
Well some time passed and now it works! I don't know what solved it exactly but I did the following:
I updated to Android Studio 0.8.12 manually, because that was the only way to update it
In a new project I tried to manually add a SettingsActivity and therefore added support-v4 to my repositories
Thanks for all your help on this silly question...
Related
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'
I get error messages when I try to add recyclerview and cardview dependencies to my build.gradle. Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.truewebdev.applytheme"
minSdkVersion 17
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.2.0'
compile 'com.android.support.recyclerview-v7:23.2.0'
compile 'com.android.support.cardview-v7:23.2.0'
}
Here are the error messages:
If I try to install repository, I get the following:
What is wrong here?
Did you download the Android Support Repository from the SDK Manager?
From android docs:
Make sure you have downloaded the Android Support Repository using the SDK Manager.
http://developer.android.com/tools/support-library/setup.html#libs-with-res
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'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 am using Android Studio 1.2. Every SDK must have AsyncTask , but my Android Studio is not able to recognize the class.Even not showing in import and autoassist.
Similarly if I write no suggestion in Autosuggest
Gradle Script:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.appxperts.printknot2"
minSdkVersion 11
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:22.1.1'
compile project(':libraries:floatingedittextlibrary')
compile files('libs/gson-2.2.4.jar')
compile 'com.larswerkman:HoloColorPicker:1.5'
compile 'com.doomonafireball.betterpickers:library:1.5.5'
compile 'com.google.android.gms:play-services:3.1.+'
}
I solved it myself.The problem was with Android Studio on Ubuntu.It is not able to automatically import AsycTask.Not even in auto-suggestions.Simply added
import android.os.AsyncTask