Downgrade SDK 23 to 22 issues - android

I was using SDK 23 but the system of permissions make me come back to the SDK 22, but I'm facing a problem that is quite common here. I visited every link but no one could really help me.
The error that I'm facing is this one:
I have my manifest like this:
And my gradle file is like this:
dependencies {
compile files('ormlite-android-4.49-SNAPSHOT.jar')
compile files('ormlite-core-4.49-SNAPSHOT.jar')
compile files('ormlite-jdbc-4.49-SNAPSHOT.jar')
compile files('signalr-client-sdk.jar')
compile files('signalr-client-sdk-android.jar')
compile project(':viewPageIndicator')
compile project(':netlogiaChartsLib')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'joda-time:joda-time:2.9.1'
compile 'com.github.alamkanak:android-week-view:1.2.6'
}
I don't know how but android studio keeps calling the SDK 23, although I already deleted from SDK manager and I only have the 22. Why is it giving this error?

Related

Getting crash report (NegativeArraySizeException) by google libraries caused

I don't know why users are getting this error. But its the biggest issue in firebase crash reporting. If anyone knows how to fix this issue or why its happening, I'll be very grateful. Thank you.
Exception java.lang.NegativeArraySizeException: -520103681
fw.a (:com.google.android.gms.DynamiteModulesA:323)
fw.c (:com.google.android.gms.DynamiteModulesA:541)
fw.d (:com.google.android.gms.DynamiteModulesA:563)
fx.a (:com.google.android.gms.DynamiteModulesA:404)
fw.a (:com.google.android.gms.DynamiteModulesA:157)
es.run (:com.google.android.gms.DynamiteModulesA:84)
I'm getting this crash report from all api levels (from 21 to 25)
build.gradle file: (all google libraries)
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:support-v13:25.3.0'
compile 'com.android.support:gridlayout-v7:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:preference-v7:25.3.0'
compile 'com.android.support:customtabs:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-analytics:10.2.1'
compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.google.android.gms:play-services-auth:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-auth:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-ads:10.2.1'
compile 'com.google.firebase:firebase-crash:10.2.1'
compile 'com.google.firebase:firebase-config:10.2.1'
I had faced the same exception and found that The problem is not in the App-level build.gradle file but it's in the Project-level build.gradle file.
When I added my android app to the firebase project, one of the steps was to add the following classpass in the Project-level build.gradle:
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.2'
}
After some time Android studio highligted indicating that there is a new version available (4.3.3) and when I updated the classpass, Android studio keep displaying the Exception java.lang.NegativeArraySizeException when I try to run the app on an Emulator win Android 7 (API 24) but when I tried another Emulator with Android 4.4 (API 19), android studio doesn't display the exception and the application runs normally.
So the solution for my case was to rollback this line from
classpath 'com.google.gms:google-services:4.3.3'
to
classpath 'com.google.gms:google-services:4.3.2'
I hope this answer could help some other developers.

Unable to resolve dependencies for Android SDK Tools

I can't install Android SDK Tools on Android Studio (version 2.3).
I got the following error,
Is there anyway I can solve this error?
TLDR; no.
Google, for whatever reason, has decided to remove direct access to the standalone SDK Manager starting with Android STudio v2.3.
If you run SDK manager directly using #iK2H 's instructions, you will see that SDK manager does not detect Android SDK Tools v25.3.1.
It could be that v25.3.1 is only available via Android Studio settings, but this is broken for now.
Your best best is to upvote this issue to draw attention to Google to fix it.
Open the terminal
$ cd "sdk path"/tools
$ ./android
Update
Google fixed this, on the server side, shortly after discovery. It should work now.
File -> Invalidate Caches / Restart
or
Build -> Clean Project can help (let me know if it did)
From Windows, search for SDK Manager and right click to 'run as administrator'. Attempt to the install it from there.
Was having the same issue and that worked for me...
Ok, I think I found the solution. Please try it out and report back on comments. Build is a success, but I still need to test by app to check for features and other possible side effects. Did not want everyone to wait until this is resolved. If this does not work or has serious issues, I am happy to delete this answer.
PLEASE COMMENT
The solution
I commented out
compile 'com.google.android.gms:play-services:x.y.z'
I also removed
com.google.android.gms:play-services-appindexing
com.google.android.gms:play-services-contextmanager
Upgraded the remaining com.google.android.gms:* services to 10.2.0
This is my working build.gradle with no errors
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
}
def applicationVersion = '*****'
dexOptions {
// incremental = true; // If anybody use below 2.2.2 android studio then please uncomment this line. It's by default true.
preDexLibraries = false
javaMaxHeapSize "2g"
}
signingConfigs {
....
}
buildTypes {
...
}
productFlavors {
...
}
packagingOptions {
...
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:25.1.1'
// compile 'com.google.code.gson:gson:2.2.4'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.crittercism:crittercism-android-agent:+'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:10.2.0'
compile 'com.google.android.gms:play-services-base:10.2.0'
// compile 'com.google.android.gms:play-services-appindexing:10.2.0'
// compile 'com.google.android.gms:play-services-contextmanager:10.2.0'
compile 'com.google.android.gms:play-services-places:10.2.0'
compile 'com.google.android.gms:play-services-nearby:10.2.0'
compile 'com.google.android.gms:play-services-maps:10.2.0'
// compile 'com.google.android.gms:play-services-ads:10.2.0'
// compile 'com.google.android.gms:play-services-auth:10.2.0'
compile 'com.google.android.gms:play-services-gcm:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
// compile 'com.google.android.gms:play-services-awareness:10.2.0'
// compile 'com.google.android.gms:play-services-cast:10.2.0'
// compile 'com.google.android.gms:play-services-plus:10.2.0'
compile 'com.google.maps.android:android-maps-utils:0.4.+'
compile 'com.google.zxing:core:3.2.0'
compile 'com.journeyapps:zxing-android-embedded:3.3.0#aar'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-analytics:10.2.0'
compile 'com.flurry.android:analytics:6.4.2'
....
}
apply plugin: 'com.google.gms.google-services'
Update your SDK tools from old "SDK Manager" UI (You can find it at <your SDK>/tools/android) to 25.2.5 then update it from Android Studio to latest version (26.1.1).
For some reasons you can't see newer versions in SDK Manager UI.

Android Studio Weird Warning

After I updated my Support library from 23.1.1 to 23.4.0 I get this warning cannot access android.support.v4.app.baseFragmentActivityEclair on every call to super and every instance of AppCompatActivity
And if I updated my support library to 24.1.1 The warning changes to cannot access android.support.v4.app.baseFragmentActivityJB.
Can anyone tell me why this warning is shown and how can I remove this warning:
here is my dependencies before:
(no error in this)
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityEclairwarning:
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityJBwarning:
compile 'com.android.support:palette-v7:24.1.1'
compile 'com.android.support:gridlayout-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
We ran into a similar problem when one of the packages in our project had dependencies on version 24.0 support libraries and another package was dependent on version 23.4.0. This seems to be a problem for the Android Studio (IntelliJ) IDE, not the compiler, because we were able to build and run the project without any problems. We resolved the warning by reverting the 24.0 dependency to 23.4.0. I suspect that going the other direction (advancing all of our package dependencies to 24.0) would also have eliminated the warning but we didn't experiment with that due to the number of packages in our project.
If you're looking to hack around this, many of the support libraries have an internal library called libs/internal_impl-$VERSION.jar that includes these types of version-specific implementations. To get your IDE to work, you can extract these JARs and manually include them in your IDE's build path.
For example, you can extract the classes referenced here, assuming version 24.2.1, using this command:
unzip support-fragment-24.2.1.aar libs/internal_impl-24.2.1.jar

failed to resolve com.android.support:appcompat-v7:22 and com.android.support:recyclerview-v7:21.1.2

I installed ALL Extra and SDK API 21-22 including changed
compileSdkVersion 22 to 21 and buildToolsVersion '22.0.1' to 21.1.2.
I'm having Rendering Problems for API 22.
I have tried changing the version to <= 21 but I'm still getting an error.
These are the correct version that you can add in your build.gradle according to the API needs.
API 24:
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:recyclerview-v7:24.2.1'
API 25:
implementation 'com.android.support:appcompat-v7:25.4.0'
implementation 'com.android.support:recyclerview-v7:25.4.0'
API 26:
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
API 27:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
In order to make that working I had to set:
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
compile ("com.android.support:design:22.2.0")
Documentation states something different (docs):
com.android.support:support-design:22.0.0
Real path for Support Repository Libraries:
You should download Support Repository Libraries.
If the problem still exists:
Go to the real path of your Support Repository Libraries and check that the following folder exists:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support"
In that folder there are support libraries that can't be found.
for example:
"ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7"
Open folder appcompat-v7 and you see folders with all available version. You should use only one of these versions in the build.gradle file dependencies or use +, for ex. 18.0.+
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
}
That is the path taken from grade.build dependencies file:
com.android.support:appcompat-v7:18.0.0
Refer to the real path on your HDD -->
ANDROID_SDK_DIRECTORY\extras\android\m2repository\com\android\support\appcompat-v7\18.0.0
If there is no such folder, you will receive the error:
"failed to resolve com.android.support:appcompat-v7:18.0.0"
p.s. If you have Windows x64, when installing sdk and jdk, make sure that the installation path does not have Program Files(86). Brackets that add Windows may cause additional problems with resolving paths for your project. Use simple paths for your installation folder.
For example:
c:\androidSDK\
Failed to find: com.android.support:appcompat-v7:22.0.0
The "I literally tried everything else" answer:
This problem will also occur if you don't have an upto date Android Support Library and Android Support Repository. Just install using the SDK manager.
Along with other provided solutions, make sure to have the following within project/build.gradle
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
in support libraries you always need to add three numbers as version number
Suppose for 22 -> you need to write it as 22.0.0, not just 22
for 22.1 -> 22.1.0
So your dependencies should look like this
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:cardview-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:22.0.0'
I Programmers language you need to pad extra zeros.
Hope this solves your problem
i solve it
change 22.0.0 to 21.0.3
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:appcompat-v7:21.0.3' }
maybe i have download the com.android.support:appcompat-v7:21.0.3 but have not got the compile 'com.android.support:appcompat-v7:22.0.0'
when i use SDK Manager update my support library and support repository , the problem dismissed.
NOTE1: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
NOTE2: Support library should not use a different version than the compileSdkVersion
For API 28 you can use:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'
https://mvnrepository.com/artifact/com.android.support/appcompat-v7/28.0.0-alpha1
https://mvnrepository.com/artifact/com.android.support/recyclerview-v7/28.0.0-alpha1
All support libraries: https://mvnrepository.com/artifact/com.android.support
It is easier to use "+" sign in the version number. For example
compile 'com.android.support:support-v4:22.0.+'
compile "com.android.support:appcompat-v7:22.0.+"
In this case you won't have to change versions for the same API number
Go to Messages Gradle Sync, and Click on Install Repository and sync project. This is will install needed file in Android SDK and after syncing you will be able to create gradle or run your project.
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Are you import them? Like this:
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile ("com.android.support:support-v4:22.2.0")
compile ("com.android.support:appcompat-v7:22.2.0")
compile ("com.android.support:support-annotations:22.2.0")
compile ("com.android.support:recyclerview-v7:22.2.0")
compile ("com.android.support:design:22.2.0")
paste the above code in your app gradle.
and while setting up the project select empty activity instead of blank activity.
Fixed my issue by changing these
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
to
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
that means your target SDK version should be same as version of cardView and recyclerView and other google libraries.
targetSdkVersion 23
Tools > Android > SDK Manager
Select all of the packages that are not up to date and update them.
I had such dependancy in build.gradle -
compile 'com.android.support:recyclerview-v7:+'
But it causes unstable builds. Ensure it works ok for you, and look in your android sdk manager for current version of support lib available, and replace this dependency with
def final RECYCLER_VIEW_VER = '23.1.1'
compile "com.android.support:recyclerview-v7:${RECYCLER_VIEW_VER}"
I solved the problem updating all packages from Android SDK Manager and also, I had to install Extras -> Android Support Repository.

Android Studio: Could not find any version that matches com.google.gms:play-services:6.1.+

I've recently updated my android studio and when I try to sync my gradle file I get the below error:
Could not find any version that matches com.google.gms:play-services:6.1.+
I understand that Android Studio ships with it's own sdk so I've installed the ADT sdk and pointed my project to this but I still get the same error, here are my gradle dependencies:
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile files('libs/Parse-1.4.2.jar')
compile project(':ws_wrapper')
compile project(':custom_slider_library')
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:6.1.+'
compile project(':shinobicharts-android-library')
compile files('libs/shinobicharts-android-trial-1.3.5.jar')
compile files('libs/androidplot-core-0.6.1-SNAPSHOT.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.2.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
}
I'm unsure as to what to do next, my sdk manager is up to date, does anyone have any ideas? I can't run this at the moment due to this issue.
If I try to add a dependency via the project structure the google play services isn't available on the maven drop down list.
Just to add this line #integer/google_play_services_version in the manifest is also causing an issue it says cannot resolve symbol
Your SDK isn't actually up-to-date. You need to install revision 12 of the Google Repository; that's the one that ships Google Play Services 6.1.11.

Categories

Resources