-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoClassDefFoundError: org/apache/commons/logging/LogFactory #476
Comments
Hi @emumair , Thanks for reporting this issue. Currently, it looks like we may be able to remove this dependency. |
Also, Mobile Analytics is no longer recommended, please use AWS Pinpoint instead. |
👍 Same issue here, now with |
Having this issue with both and |
Has anyone solved this problem yet? I reduced my targetSdk and compileSdk to 27. And it worked! |
I'm also affected by this issue. The crash occurs downstream from the call to
Release date for Android P is likely to be 3rd week of August if it follows the pattern of Oreo and Nougat. It would be frustrating if this issue prevented us from using Android P at launch. Thanks. |
Please add dependency for now:
|
is working for me, thanks. Initially I had problems in my submission build, I had to add this lot into my proguard rules to get that working.
|
We also have this issue. Including implementation |
We are having this issue now when attempting to release a signed build:
This is including the proguard stuff that C0lumbo recommended. So we're still stuck releasing for Android Pie and targeting API level 28. Any ETA on getting this fixed, considering that Google just started rolling out Android Pie to Pixel devices, etc? |
Also there's this: https://developer.android.com/about/versions/pie/android-9.0-changes-all#apache-nonp
|
I'm using: What about this closed issue? |
The correct answer on this case is to just use Java's Logger or even create a wrapper class around it with some of the missing functionality such as |
Android Pie runtime has a crash that's not on earlier Androids. Is anybody at Amazon on a fix for it? |
+1 |
almost forgot about this issue - these lines in build.gradle seem to work with the S3 SDK so that the Android P runtime does not crash api 'com.amazonaws:aws-android-sdk-core:$version' |
@minbi I'm having the same issue here; Is there any release coming soon that solves this problem? |
This is quite blocking! |
Adding 'commons-logging:commons-logging:1.1.1' as a dependency causes crashes in other libraries like the Google Maps SDK. This is blocking a scheduled release. |
It's blocking us from uploading and downloading files to S3 in production on Android P devices. |
@minbi The problem with locking #265 is that this issue refers to MobileAnalyticsManager while the earlier, closed issue refers to a problem with client initialization. The problem I am experiencing is with the S3 client fetching keys. Developers using the S3 APIs might be led to believe that the NoClassDefFoundError on the S3 client is solved when it is not. |
@emezias , correct me if I am wrong, but aren't these both related to the usage of commons logging in the SDK? |
You might say instead that these reports are related to compatibility with
Android 9. The problem is in the Amazon SDK logging. They report the
problem using different packages in the SDK that are crashing with the
latest Android. The Android apps are not using the commons logging objects.
It looks like there was an earlier pull request and fix for #265. This
would mean you have both a new bug and a regression.
…On Mon, Aug 20, 2018, 7:11 PM minbi ***@***.***> wrote:
@emezias <https://github.com/emezias> , correct me if I am wrong, but
aren't these both related to the usage of commons logging in the SDK?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#476 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAyqsZZdyRho8Hf7k8H8HTobwnfhzZ4sks5uS0IQgaJpZM4UfhVC>
.
|
@emezias , we are treating this as the issue for tracking the commons logging issue for all SDKs under AWS Android SDK: S3, Cognito, Mobile Analytics from whichever library they surface. Feel free to open another issue if your issue differs significantly. Closed issue are not monitored, but I saw a bit of activity, so I locked it with a redirect to this issue. |
Thanks @minbi. If that is the case the issue title referring to the
MobileAnalyticsManager is specific and confusing. Can you correct it?
Developers that do not use Amazon for analytics are affected. Issue 265 on
the S3 Amazon client was filed before this one and is still a problem.
…On Mon, Aug 20, 2018, 8:35 PM minbi ***@***.***> wrote:
@emezias <https://github.com/emezias> , we are treating this as the issue
for tracking the commons logging issue for all SDKs under AWS Android SDK.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#476 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAyqsWHyeUkExMoQS92PLMRa4bGjedzbks5uS1W5gaJpZM4UfhVC>
.
|
@minbi It would be valuable in the future to include the reason and more explicit direction when stopping an active conversation. Additionally if this is to be the primary issue for the bug: updating the title, providing details (in summary) of the root cause, and adding any insight into the status of your investigation would be appreciated. |
We have fixed this in 2.6.30. The maven release is in progress. The changes are pushed to GitHub. Apologies for the delay in getting the fix. Please upgrade to the latest and let us know if it fixes the issue. |
Description of the fix: We introduced a LogFactory and Log interface in the SDK (aws-android-sdk-core) and made Apache Commons Logging and android.util.Log as implementations of the Log interface. By default, the LogFactory checks if Apache Commons Logging is present, if so, it will use the Commons Logging as the logger, else it will use android.util.Log. Customers who want to use Apache Commons Logging can import it as an explicit dependency and LogFactory will use it. Please feel free to provide feedback on this fix. We will be happy to take in the recommendations. Closing the issue. |
@AnthonyUccello Do you need commons logging for your project? If not, then you can let it default to Android logging instead. |
I spoke too soon, my build server threw this error:
@minbi Can you clarify how I let it default to Android logging instead? This is failing when I try to mock an object (failing with the original error this thread is about) |
@AnthonyUccello Can you upgrade to the latest 2.7.+ and see if it fixes the issue? We fixed this issue in |
@kvasukib Yes! That did fix it! Thank you! |
Guys the proper workaround is the same you need for using Google Maps: Add this inside your Application in the App manifest
still has to be fixed in the library. |
Fixes the following error: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.logging.LogFactory" Solution based on the following issue: aws-amplify/aws-sdk-android#476
The Android SDK uses HttpURLConnection as its HTTP runtime. aws-android-sdk-core contains dead code that references the legacy Apache HTTP Client used by the V1 Java SDK, from which this codebase originates. The Apache HTTP client has considerable baggage on the Android platform, and can cause runtime failures. In an effort to fully remove it from the codebase, it is being removed from core. As of this commit, Apache Logging is still a compile-time dependency in core. If it is provided at runtime, it will be used. Otherwise, the SDK will fallback to logging against the Android Log utility. This behavior is discussed here: #476
The Android SDK uses HttpURLConnection as its HTTP runtime. aws-android-sdk-core contains dead code that references the legacy Apache HTTP Client used by the V1 Java SDK, from which this codebase originates. The Apache HTTP client has considerable baggage on the Android platform, and can cause runtime failures. In an effort to fully remove it from the codebase, it is being removed from core. As of this commit, Apache Logging is still a compile-time dependency in core. If it is provided at runtime, it will be used. Otherwise, the SDK will fallback to logging against the Android Log utility. This behavior is discussed here: #476
I am using : implementation 'com.amazonaws:aws-android-sdk-s3:2.19.0' and can still see the issue. Can anyone here let me know if this was fixed and released ? Anybody faced this issue recently ? |
Hi @sauravpradhan , |
@sauravpradhan @raphkim Ah yes. In #2014, I set out to remove our dependency on the Apache HTTP client. As part of that, I've removed this line from the useLibrary 'org.apache.http.legacy' I suspect that this has removed the logging dependency from the runtime classpath, as well. Some workarounds for the consumer are suggested in this StackOverflow thread. I believe our next step here will be to remove the Apache Logging dependency entirely. |
I cannot move to a SDK < 28, more over the problem is when we progaurd the app. Debug apk and non progaurded relase apk's are fine . Adding the implementation of commons or even including jar did not work out for me. And since it was fixed long back , I was really looking for my project configs as all comments suggested it's fixed. @raphkim Thanks for reopening this. |
No android. Latest version of your SDK today: 2.17.24. Just plain java and very easy code S3Client s3 = S3Client.builder() |
You can try it, like this:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
…------------------ 原始邮件 ------------------
发件人: "Pekka ***@***.***>;
发送时间: 2021年8月23日(星期一) 晚上10:10
收件人: ***@***.***>;
抄送: ***@***.***>; ***@***.***>;
主题: Re: [aws-amplify/aws-sdk-android] NoClassDefFoundError: org/apache/commons/logging/LogFactory (#476)
No android. Latest version of your SDK today: 2.17.24. Just plain java and very easy code S3Client s3 = S3Client.builder()
.region(Region...)build();
ListBucketsResponse listBucketsResponse = s3.listBuckets();
listBucketsResponse.buckets().stream().forEach(x -> System.out.println(x.name()));
and
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.http.conn.ssl.AbstractVerifier.(AbstractVerifier.java:61)
at org.apache.http.conn.ssl.AllowAllHostnameVerifier.(AllowAllHostnameVerifier.java:44)
at org.apache.http.conn.ssl.AllowAllHostnameVerifier.(AllowAllHostnameVerifier.java:46)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.(SSLConnectionSocketFactory.java:151)
at software.amazon.awssdk.http.apache.ApacheHttpClient$ApacheConnectionManagerFactory.getPreferredSocketFactory(ApacheHttpClient.java:630)
at software.amazon.awssdk.http.apache.ApacheHttpClient$ApacheConnectionManagerFactory.create(ApacheHttpClient.java:609)
and adding
commons-logging
commons-logging
1.2
to my pom didn't help. I think it's common problem of the ApacheHttpClient but I have java 11 with better http client, why are you still using the apache one? I also used it too in the past but today?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
@jarve Did you manage to fix this? I keep getting this trying to start a DynamoDBClient and I'm really stumped as to why. |
No, but I found go program called rclone to use. |
What service are you using?
Mobile Analytics
In what version of SDK are you facing the problem?
implementation 'com.amazonaws:aws-android-sdk-core:2.4.2'
implementation 'com.amazonaws:aws-android-sdk-mobileanalytics:2.4.2'
Is the issue limited to Simulators / Actual Devices?
No
Can your problem be resolved if you bump to a higher version of SDK?
No
Is this problem related to specific Android/OS version?
Yes, API level 28
Runs well on version <= 27 but throws exception when app is run on version 28.
Crash occurs at:
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(context, BuildConfig.AMAZON_IDENTITY_POOL_ID, region);
Saw a similar issue here but the given solution is not working for me.
testCompile 'commons-logging:commons-logging:1.1.1'
and
testImplementation 'commons-logging:commons-logging:1.1.1'
both are not working.
The text was updated successfully, but these errors were encountered: