I am working on an application. It works perfectly on a device with android 5.0. But crashes constantly on lower versions.
Have so far tried it out on 4.4.4, 4.4.2.
I get the following error.
java.lang.NoClassDefFoundError: android.support.v4.util.ContainerHelpers
at android.support.v4.util.SimpleArrayMap.<init>(SimpleArrayMap.java:209)
at android.support.v4.app.FragmentActivity.getLoaderManager(FragmentActivity.java:867)
at android.support.v4.app.FragmentActivity.getSupportLoaderManager(FragmentActivity.java:861)
at com.client.login.LoginActivity.populateAutoComplete(LoginActivity.java:164)
at com.client.login.LoginActivity.setupView(LoginActivity.java:126)
at com.client.login.LoginActivity.onCreate(LoginActivity.java:71)
I am using android studio for development. My build.gradle is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId 'com.client'
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
}
}
productFlavors {
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/com.fasterxml.jackson.databind.Module'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:appcompat-v7:22.1.1'
//compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
compile 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.5.0'
compile 'joda-time:joda-time:2.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
compile 'com.google.guava:guava:18.0'
compile 'com.google.android.gms:play-services:7.3.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.etsy.android.grid:library:1.0.5'
}
Thanks a lot.
Found the solution on this post
java.lang.NoClassDefFoundError: android.support.v4.app.NavUtilsJB error when adding new module in Android Studio
Problem was due to multi dexing being added in lollipop. Had to add the multidex support library to my gradle for previous android versions.
Related
No problem on running other devices lollipop,marshmallow,nougat emulators and real devices. Oreo 8 doesnot support. showing this error INSTALL_FAILED_NO_MATCHING_ABIS .
gradle below
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.paulcart.administrator.wibslink"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-
annotations'
})
compile files('libs/PhotoUtil.jar')
compile files('libs/GenAsync.1.2.jar')
compile 'com.wajahatkarim3.EasyFlipView:EasyFlipView:1.0.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
}
android {
useLibrary 'org.apache.http.legacy'
}
android { sourceSets { main { res.srcDirs = ['src/main/res',
'src/main/res/layout-land'] } } }
tried this to
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
However this did not work, in order to make sure that the problem was with the Oreo 8.0 Emulator and I checked a OREO Real device too and problem still exists
Help me to solve this.
8.0 is much more strict about what's in the lib folder
extract apk file, see what's under lib/
use packagingOptions to exclude non so files under lib/
example(in android block):
packagingOptions {
exclude 'lib/commons-lang-2.6.jar'
}
Reference: https://issuetracker.google.com/issues/65941637
I'm trying to update my app to use api level 26 and now I'm getting a very painful error when trying to start up the app. Here is the exception that seems to be causing it:
Caused by: java.lang.NoSuchMethodError: No static method getScaledHorizontalScrollFactor(Landroid/view/ViewConfiguration;Landroid/content/Context;)F in class Landroid/support/v4/view/ViewConfigurationCompat; or its super classes (declaration of 'android.support.v4.view.ViewConfigurationCompat' appears in /data/app/com.sprayme.teamrsm.analyticspraydown-2/base.apk)
My gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.sprayme.teamrsm.analyticspraydown"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "com.android.support:support-core-utils:26.0.2"
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:recyclerview-v7:26.0.2'
compile 'com.android.support:preference-v7:26.0.2'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile('com.mikepenz:materialdrawer:5.9.5#aar') {
transitive = true
}
testCompile 'junit:junit:4.12'
}
If I set my compile and target versions back to 25 and the compile items back from 26.0.2 to 25.1.3 like I had them before, everything runs again.
I have searched high and low and haven't found anything that's helped yet. Anyone have any ideas?
Somewere in your classes or libraries you use the getScaledHorizontalScrollFactor method. This method is in the ViewConfigurationCompat class. According to Google, this class is deprecated in api 26. You have to use ViewConfiguration directly.
https://developer.android.com/reference/android/support/v4/view/ViewConfigurationCompat.html
I develop with Android version 23. But now I like to debug a device having only version 19 installed.
To do it I changed my gradle file to
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.mydomain.myapp"
minSdkVersion 16
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile fileTree(include: ['dtp_library'], dir: 'libs')
compile project(':libs:dtp_library')
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:design:19.+'
compile 'com.android.support:support-v4:19.+'
}
But this line
compile 'com.android.support:design:19.+'
throws the compiler error
Failed to resolve 'com.android.support:design:19.+'
How to make it work?
This is a sample of my build.gradle and it runs absolutely fine on an API 19 device.
Few things to note are that you don't need to decrement the compile SDK. This is like having Java 8 installed, but compiling Java 6 code. It still works.
Also, I think the appcompat-v7 library depends on the support-v4 library, so you don't need to include that.
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.androidstack.app"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
ext {
supportLibVersion = '23.2.1' // variable that can be referenced to keep support libs consistent
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
}
Remove compile 'com.android.support:design:19.+' then try
hello i want create a android apk.
and need to use from "com.mcxiaoke.volley" and "com.android.support:appcompat"
please give me a build app for my app.
current build app is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
//buildToolsVersion "23.0.2"
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "boxweb.asia.shopcenter"
minSdkVersion 14
targetSdkVersion 23
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:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.volley:volley:1.0.0'
}
but don't work and show error.
error is : http://up.vbiran.ir/uploads/45106145544003944084_Untitled-1.jpg
i can not download "https://jcenter.bintray.com/com/android/volley/volley/1.0.0/volley-1.0.0.pom" in android-studio but can download in browser.
help me to install plugin from file.
please help me
Adding volley support can done just by adding compile 'com.mcxiaoke.volley:library:1.0.19 to gradle.build dependencies module.
dependencies
{
compile 'com.mcxiaoke.volley:library:1.0.19'
}
Go through Android Volley Library
Make sure you have jcenter() in your dependencies. So your build.gradle should have:
repositories {
jcenter()
}
dependencies {
compile 'com.android.volley:volley:1.0.0'
}
Note:
The repositories block can either be in your root build.gradle or your app/build.gradle.
I download a Android Studio project from https://github.com/chenyangcun/MaterialDesignExample . I add it to my Android Studio and run it,but there occurs some errors:
The blew is the build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.aswifter.materialexample"
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:design:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'com.google.code.gson:gson:2.3'
compile 'com.afollestad:material-dialogs:0.7.6.0'
}
And then I build a whole new Android project with the same "third-party libraries"
The blew is my bulid.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.mummyding.app.test"
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'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.loopj.android:android-async-http:1.4.7'
compile 'com.google.code.gson:gson:2.3'
compile 'com.afollestad:material-dialogs:0.7.6.0'
}
What confuses me is the "error info":
compile 'de.hdodenhof:circleimageview:1.3.0' is okay in this project!!!
so my questions:
Can you run this project in your Andorid Studio?
Why the "error info" different?
How to fix it?
PS:
Gradle Version : 2.2.1
IDE: Android Studio 1.2.1.1
OS: Ubuntu 15.04
I am in China but I have got a router with shadowsocks (which means I can visit any website I want)
It really confuse me for a long time,so any suggestion will be highly appreciated,thank you advance.
The problem may be your proxy settings. You may need to set the following in gradle.properties (please modify according to your proxy settings):
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=8123
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=8123
I fixed it!!!!
It's not caused by GFW .It works well when I replaced OpenJDK with Oracle-JDK on my ubuntu!
Please try this with sudo
dnf install python3-m2crypto
https://fedora.pkgs.org/35/fedora-x86_64/python3-m2crypto-0.38.0-2.fc35.x86_64.rpm.html