Cant find 'com.android.support:design:22.2.0' - android

I want to use the FloatingActionButton but for that I need the library:
compile 'com.android.support:design:22.2.0'
But when I add it to my gradle, I get the message:
A problem occurred configuring project ':myModule'.
Could not resolve all dependencies for configuration ':myModule:_debugCompile'.
Could not find com.android.support:design:22.2.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.pom
https://jcenter.bintray.com/com/android/support/design/22.2.0/design-22.2.0.jar
file:/D:/Development/Android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom
file:/D:/Development/Android/sdk/extras/android/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar
file:/D:/Development/Android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.pom
file:/D:/Development/Android/sdk/extras/google/m2repository/com/android/support/design/22.2.0/design-22.2.0.jar
Required by:
myProject:myModule:unspecified
I tried updating my Android SDK but everything is up to date:
So why can't com.android.support:design:22.2.0 be resolved?
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "de.bla.myProject"
minSdkVersion 19
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':androidcircularcrop_lib')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:design:22.2.0'
compile files('libs/eventbus-3.0.0-beta1.jar')
compile files('libs/mpandroidchartlibrary-2-1-0.jar')
compile files('libs/picasso-2.4.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
}

Looking at your build file, always set target and compile sdk to the same number. The appcompat lib is also a part of the sdk so when using a 22.x.x support lib, you are goning to need at least the 22 sdk to ensure compatibility, let alone finding the lib.
Also as Arkadiy suggested it is recommended to use the latest build-tools and gradle version compatible with your android studio.

Related

Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE envrinment variable to

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.xxxxx.xx.xx.xx.xxxxx"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2g"
}
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
compile files('libs/DTBSCommon.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.squareup.dagger:dagger-compiler:1.2.1'
compile 'com.android.support:design:23.1.1'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.0.6'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.0.6'
compile 'com.fasterxml.jackson.core:jackson-databind:2.0.6'
compile 'com.android.support:support-v4:23.1.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
}
This error is due to your build tool version and compileSDKVersion.
Here is a workarond for it.
First of all download and install all available updates from SDK Manager.
Then create a new project. As you are using google play services plugin in your current app, apply google play services plugin to newly created project.
Now Compare the build.gradle(Module App) for both the applications and make changes to in your old project build.gradle(module app). Also update the various dependencies to their latest versions. After making changes sync the gradle and it should work like charm.

Error while importing Eclipse project to Android Studio for support lib. v7

I am new to android studio And I'm trying to import eclipse project in android with few dependent android projects.
Please see below attached image and my message console for the error.
I have tried by changing API version to 24 which is latest nothing happen and again back to API 21 after one answer on SO.
Gradle version.
In wrapper I've 2.14.1 and in file I've 2.1.3
build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "package.name"
minSdkVersion 11
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':comtwittersdkandroid_twitter')
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:appcompat-v7:21.2.0'
compile files('libs/httpclient-4.3.3.jar')
compile files('libs/httpcore-4.4.1.jar')
compile files('libs/httpmime-4.3.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
compile files('libs/universal-image-loader-1.8.0.jar')
compile files('libs/zxing-1.7-core.jar')
compile files('libs/zxing-integration.jar')
}
I've tried adding jar instead of compile statement, it's not working.
Any help will be appreciated, thanks in advance.
Since you are using
compile 'com.google.android.gms:play-services:+'
you have a dependency with the support libraries v24 which require api 24 to compile.
You have to use:
compileSdkVersion 24
Thanks for your help, I finally break into the issue that is I have to delete com_crashlytics_export_strings.xml file from my project.
As I switch to API version 23 I removed http jars and added compile statements to build.gradle
One Important thing I've observed is "if you've dependent projects please cross check everything, as the main project mostly do not compile because of the issue with using same lib. in dependent projects or deprecated functions; as I have one for maps in one of my classes.
my build.gradle file
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "package-name"
minSdkVersion 11
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile('org.apache.httpcomponents:httpmime:4.3.6')
compile files('libs/universal-image-loader-1.8.0.jar')
compile files('libs/zxing-1.7-core.jar')
compile files('libs/zxing-integration.jar')
compile files('libs/gcm.jar')
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:appcompat-v7:23.2.0'
}
Thanks for the help. Answer to help anybody who faces same issue in the future.

Compiler errors in Android API 24 source code

After downloading and installing the API 24 source code, I am seeing a large number of compiler errors in classes that have changes in API 24.
For example, the AccessibilityService class has hundreds of "Cannot resolve symbol" errors on variables, methods, imports etc.
I have tried deleting and redownloading sources multiple times to no avail. Is this a common occurrence with a new set of sources or did I do something wrong?
Edit:
Here is my app Gradle file, and I am using 'com.android.tools.build:gradle:2.1.0'
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.nyelito.dactyl"
minSdkVersion 23
targetSdkVersion 24
versionCode 10
versionName "1.2.2"
}
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(
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
)
provided 'org.glassfish:javax.annotation:10.0-b28'
compile('com.mikepenz:aboutlibraries:5.6.7#aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.github.medyo:android-about-page:1.0.5'
compile 'com.github.thepacific:adapter:1.0.5'
compile 'com.google.firebase:firebase-database:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.paolorotolo:appintro:4.0.0'
}
apply plugin: 'com.google.gms.google-services'
Here is a screenshot of what it looks like
When you change compileSdkVersion, you also need to change buildToolsVersion to something compatible. In this case
buildToolsVersion 24.0.2
#Code-Apprentice is right, you need to change buildToolsVersion with the major version number compatible with your compiled sdk version.
'android-24' requires JDK 1.8 or later to compile
https://developer.android.com/guide/platform/j8-jack.html
Also, I found you compiled with API 24, which needs JDK8. Please adds the following in your build.gradle
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

Signing failed after updating Android Studio

I updated my android studio from 1.5 version to current latest v2.1.1 and also updated build tools version to 2.1.0 and gradle distributionUrl to https://services.gradle.org/distributions/gradle-2.10-all.zip
After updating this changes, I am able to run the application on device but when I try to code sign the application getting this error -
Error:Execution failed for task ':projectName:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/android/internal/http/multipart/PartSource.class
Here's look at my build.gradle file -
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'aliasname'
keyPassword ''
storeFile file('/opt/keystorename.keystore')
storePassword ''
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.companyname.project"
minSdkVersion 9
targetSdkVersion 23
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
multiDexEnabled true
}
dexOptions{
incremental true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.config
zipAlignEnabled true
}
}
}
dependencies {
compile project(':libraryInfiniteScrollListView')
compile project(':libraryPagerSlidingTabStrip')
compile project(':libraryParallaxScroll')
compile project(':library_CardView_Supportv7')
compile(project(':librarySwipeListView'))
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile files('libs/AndroidEasingFunctions-1.0.0.jar')
compile files('libs/AndroidViewAnimations-1.0.6.jar')
compile files('libs/calligraphy-1.1.0.jar')
compile files('libs/flexjson-2.1.jar')
compile files('libs/libBeaconService.jar')
compile files('libs/libraryhttploopj.jar')
compile files('libs/localytics.jar')
compile 'com.nineoldandroids:library:2.4.0'
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:multidex:1.0.1'
// org.apache.http package is deprecated and removed in 23 sdk version and above
compile files('libs/org.apache.http.legacy.jar')
}
And My application class is extending MultiDexApplication class instance.
I have even updated my buildToolsVersion to "23.0.3" from "23.0.1" but still getting the same above error.
It will be really helpful if someone can point out what is broken?
So it finally turns out that PartSource.class was present in org.apache.http.legacy.jar. And org.apache.http.legacy.jar was added as a dependency in one of the library project and also in project's dependency. It was resolved by commenting out the org.apache.http.legacy.jar dependency in project's gradle.
Still I have no clue as to why it was working on older android studio version and why it is working if i run/debug the app. But still, problem is resolved now

class android support v4 print helper has been already added to output

I just updated my android studio to the latest version with the new gradle version also, running my application gives me an error class android support v4 has been already added to the output don't know what is going wrong i check if there is a jar duplicated or a library duplicated couldn't find anything. here is my app:build.gradle
enter code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
lintOptions
{
checkReleaseBuilds false
//abortOnError true
}
defaultConfig {
applicationId "package name"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes
{
release {
minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
dexOptions {
preDexLibraries = false
incremental true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project('Libraries:UniversalImageLoader')
compile project('Libraries:facebook')
compile project('Libraries:pull-to-refresh')
compile files('Libraries/gcm.jar')
compile files('Libraries/quickblox-android-sdk-chat-2.0.jar')
compile files('Libraries/quickblox-android-sdk-core-2.0.jar')
compile files('Libraries/quickblox-android-sdk-messages-2.0.jar')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.google.maps.android:android-maps-utils:0.3'
compile 'com.squareup.picasso:picasso:2.4.0'
compile "com.android.support:appcompat-v7:21.0.2"
}
I took of this
compile 'com.android.support:support-v4:21.0.2'
i thought its already included in the appcompat-v7 but it did not solve my issue yet
I downgraded my Android Studio version to 0.8.6 and the "Duplicate Copies" error disappear.
It isn't a perfect solution but for now and for me it is the unique solution currently.

Categories

Resources