Error in android dynamodb -- NoClassDefFoundError logging.LogFactory - android

I am developing an app where I am using Amazon DynamoDB using DynamoDBmapper. I am getting the following error.
Following is a logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.amazonaws.org.apache.commons.logging.LogFactory
at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.
Even after I did everything that is suggested here, I am not getting rid of the error.
Can someone help me?
I am using Android Studio. I added the commons-logging.jar in the libs folder.
I am not sure what else do I mention here. If you could ask particular question, I would be able to reply.
Guys.. please help. Already wasted a week trying find solution for this without any luck yet.
AWS Android SDK: 2.2.13
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.example.lenovo.dynamodb6"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
resources.srcDirs = ['src/main/java']
}
}
productFlavors {
}
repositories {
jcenter()
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile files('libs/commons-logging-1.2.jar')
compile files('libs/commons-codec-1.6.jar')
compile files('libs/jackson-core-2.5.3.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/jackson-annotations-2.5.0.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.amazonaws:aws-android-sdk-core:2.2.13'
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.13'
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.1.8' }

The problem is incorrect version of DynamoDB mapper. Please bump com.amazonaws:aws-android-sdk-ddb-mapper to 2.2.13 or later. The structure of AWS Android SDK libraries has been changed from 2.1.x to 2.2.x. Please don't not mix them.
PS: using Apache HttpClient 4.3 in an Android project may cause trouble, as Android has its legacy version of HttpClient.

Related

Data binding cannot be added to my project

In my Android project, I have needed to enable the dataBinding library in module level build.gradle as below, but it gives me the error in the image. How can resolve it?
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.nasser.studio.multipledeletelistview"
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding{
enabled = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.codesgood:justifiedtextview:1.0.2'
}
Edit 1.
I've changed the project level build.gradle to add support-v4 library, but now it throws the following error:
repositories {
google()
jcenter()
configurations.all {
resolutionStrategy.force "com.android.support:support-v4:27.0.2"
}
}
one of your 3rd party libraries or sdk you use rely on support version 21.0.3. Either remove it or have resolutionStrategy in your Gradle.
configurations.all {
resolutionStrategy {
force ....
}
}
Try upgrade your android gradle plugin.
Add compile "com.android.support:support-v4:27.0.2" manually to your gradle file.
That should solve your problem.
That's not a Databinding error, It's just saying that all your support-related libraries should use the same version. For example look at my gradle file:
implementation "com.android.support:recyclerview-v7:$libraries.googleSupportVersion"
implementation "com.android.support:appcompat-v7:$libraries.googleSupportVersion"
implementation "com.android.support:support-v13:$libraries.googleSupportVersion"
implementation "com.android.support:design:$libraries.googleSupportVersion"
implementation "com.android.support:cardview-v7:$libraries.googleSupportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
My support library version being:
ext.libraries = [
...
googleSupportVersion : '27.1.1',
...
]
Your issue seems to be that compile 'com.codesgood:justifiedtextview:1.0.2' internally is using the support library with a version different than yours. However your version is totally updated I wouldn't downgrade it just to have it match with the other, in any case you could just add a:
allprojects {
configurations.all {
resolutionStrategy.force "com.android.support:support-v4:27.0.2"
}
}
In your project gradle. You could also run gradlew app:dependencies in the Android Studio console, do a Ctrl+F on the output, search for that com.android.support:support-v4:27.0.2 and figure out from where is coming. (You only have one dependency for what I see, so there's not much science from where IT should be coming)
Let me know if this works for you.

Add AppCompat dependency to Gradle in Android Studio

Verdant newbie here. I'm making a fairly simple project that needs to be compatible with Android versions older than Lollipop, but still want to have the app look nicer by using AppCompat.
Unfortunately, I do not know how to work (or even find) the gradle - I tried to run a gradle task: compile "com.android.support:appcompat-v7:21.0.+"
But it returned an error saying that "Task 'compile' is ambiguous...." in my project.
Could anyone tell me how to add this? I've searched all over Google, but everything goes way over my head.
Thanks!
Have you been able to locate Gradle file?
Edit your gradle like this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.xyz.xyz"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.00.00"
}
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.3.0'
compile 'com.android.support:support-v4:23.3.0'
}
Update your question and post full Gradle code.
Add the appcomapt library(com.android.support:appcompat-v7:21.0.+") in dependancy section of the build.gradle file
Or second way to add library is by searching on maven repo.this can be done by traversing file->project structure->app>dependancy->click (+) ->add Library dependancy
Task 'compile' is ambiguous.
This issue is not the Compile Issue. but this was an issue on the task itself.
if you are not using a command like "gradle compileDebug" then one of the android configurations are executing the task and it is not working well with your build.gradle.
Here is a link that seems to relate specifically to your issue. Click Here

Error including library htmlCleaner

I'm a beginner in android developing whith Android Studio.
I'm trying to include the htmlcleaner library in my project, but when I rebuild the project, Android Studio return this Error
Error: COnfiguration whit name 'default' not found
I added in the root folder of my project the library folder, so I added this line in settings.gradle
include ':htmlcleaner'
and this line in build.gradle
compile project (':htmlcleaner')
Is there anyone who can help me? thanks
to include many informations, I post the build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.rob_company_domain.sunshine"
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.1.1'
compile project (':htmlcleaner')
}
If you want to add your htmlcleaner library to your project in Android studio, you can do it in three standard ways. Please read this link https://stackoverflow.com/a/35369267/5475941. In this post I explained how to import your JAR files in Android studio and I explained all possible ways step by step with screenshots. I hope it helps.

Android Gradle build error Need to connect with database

Do i need to add any jar file. or need to and any dependencies
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
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.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http. client:4.1.2'
compile "org.apache.httpcomponents:httpmime:4.2.3"
}
And it displays this error in console:
Warning:Dependency org.apache.httpcomponents:httpclient:4.5 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.5 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
On the contrary, you need to remove a dependency. The warning message is telling you that you're trying to import a dependency that's already included in Android. So you might not need the line
compile 'org.apache.httpcomponents:httpclient:4.5' #Try removing this line
Try removing it and see if the app works correctly. If it doesn't and you still need to import HttpClient, please refer to this page (it's posted just a few days go by apache.org, it doesn't get any more official than that).
The link above basically tells you that you should use:
Apache HttpClient 4.3 port for Android when targeting Android API 22 and older
dependencies {
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}
or
Apache HttpClient packages for Android maintained by Marek Sebera when targeting Android API 23 and newer
dependencies {
compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
}

Android Studio gradle doesn't compile the specified version

I've been developing this small project for some days now but suddenly today, Android Studio started to give me this error
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 14 declared in library com.android.support:support-v4:21.0.0-rc1
I understood that it is because it's trying to compile the library of Android-L. The version I want it to compile is the old version but it won't. It keeps giving me the above error no matter which version I enter. Here is the dependencies.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
}
UPDATE
I just installed Android Studio Beta and changed my dependencies to the one Eugen suggested below. But syncing the project gives the same error no matter which version of appcompat, support version I specify. It gives this error every single time I sync
uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
My updated dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
}
UPDATE 2
I don't think I understand the dependencies system of Android Studio correctly. I just removed both the appcompat and support from the dependencies and it still gives me the same error. Do I have to remove the initially included libraries from somewhere?
build.gradle
*note - I added those two libraries back in again and tried syncing, just in case. But no chenges.
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "taz.starz.footynews"
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:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.+'
compile project(':ParallaxScroll')
compile files('src/main/libs/Header2ActionBar-0.2.1.jar')
compile 'com.arasthel:gnavdrawer-library:+'
compile 'com.koushikdutta.ion:ion:1.2.4'
}
Top level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
UPDATE: Found the real fix for my case. Make sure none of your dependencies are silently including support-v4 r21 by doing this in your build.gradle:
compile("com.blahblah:blah:123") {
exclude group: 'com.android.support', module:'support-v4'
}
You can add the exclude to all libraries, then remove one-by-one until you figure out which one was pulling in support-v4 and giving you the error. And leave exclude on that one.
There is a new bug filed here: https://code.google.com/p/android/issues/detail?id=72430
Assuming you are using the Support Repository, the workaround is to comment or remove the line
<version>21.0.0-rc1</version>
in the local Maven repo listing file at <android-sdk>/extras/android/m2repository/com/android/support-v4/maven-metadata.xml
With the last updates, using this:
compile 'com.android.support:support-v4:20.+'
or
compile 'com.android.support:support-v4:+'
you are using the support lib in L-preview.
These support libs are declaring minSdkVersion L.
You have to force the minSdkVersion to be 'L' (check the doc)
This is because these APIs are not final. It is a way to prevent installing the apps on a final API 21 device or publishing it on the store using support lib 21-r1.
Using
compile 'com.android.support:support-v4:19.1.0'
you are using the "old" support library 19.1.0.
I had the same issue as one of my dependencies had specified 'support-v7:+' as a dependency. I was able to track this down using gradle dependencies
Gradle provides a way to force resolution to a specific version. I ended up having this in my build.grade:
compile('com.android.support:appcompat-v7:19.1.0') {
// really use 19.1.0 even if something else resolves higher
force = true
}
compile('com.android.support:support-v4:19.1.0'){
force = true
}
This worked for me
That is correct. The new support library is not compatible (yet) with old Android versions.
Change your gradle to:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:support-v4:19.1.+'
}
I hope your still have something like this:
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
}
I was getting the error:
Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 4 declared in library
C:\Users\Igor\AppData\Local\Android\sdk\samples\android-21_1\legacy\ApiDemos\app\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.3\AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v4" to force
usage
Then I resolved it by putting the following in my defaultConfig gradle block:
minSdkVersion 15
targetSdkVersion 21
In Android SDK Manager install "Android Support Repository" from "extra" group. It helps me. When I added "exclude group: 'com.android.support', module:'support-v4'" build was completed, but some other errors was occured

Categories

Resources