A signed exported Android application that crashes with the apache.commons.logging class cannot be converted to 'aaaac'

My app works fine when I launch an Android app from Eclipse. In the past, I have also successfully exported a signed version of the application.

Now the exported version of the application crashes suddenly. Key message seems to be

Called: aaaab: The selected LogFactory implementation does not extend LogFactory. Check the configuration. (A java.lang.ClassCastException is thrown: the application indicated that a custom LogFactory implementation should be used, but the class 'org.apache.commons.logging.impl.LogFactoryImpl' could not be converted to 'aaaac'. Please check the custom implementation. Help can find @ http://commons.apache.org/logging/troubleshooting.html .).

Here are the Proguard settings. Am I missing something?

-dontwarn org.apache.** -dontwarn org.apache.commons.logging.** -ignorewarnings -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers 

apache.org doc says:

A custom LogFactory implementation can only be used if the implementation class loaded dynamically at runtime can be ported to the LogFactory class that loaded it. There are several ways in which this cast can fail. The most obvious is that the source code cannot actually extend LogFactory. The source may be compatible, but if the LogFactory class with which the source code is compiled is not binary compatible, then the tide will also fail.

There is another unusual way in which this cast may fail: even if the binary is compatible, the implementation class loaded at runtime may be associated with another instance of the LogFactory class. See the Technical Guide for more information.

This situation may occur in containers that use a custom implementation of LogFactory. An implementation will typically be provided in a shared high-level class loader along with the JCL. When the application class loader contains LogFactory, the implementation will be loaded from this higher level class loader. The implementation class will be associated with the LogFactory class loaded by the higher level class loader. Even if the LogFactory implementations are binary compatible because they are loaded by different class loaders, the two instances of the LogFactory class are not equal, and so the cast should fail.

They say potential fixes include:

There are various solutions to this problem. The right decision depends on the circumstances.

If you like to use a different class loading policy for the application, select a class loading policy that ensures that LogFactory will be loaded from a common classloader containing a custom implementation.

If you want to bypass the container adaptation mechanism, set the corresponding system property to the default value when the container starts:

-Dorg.apache.commons.logging.LogFactory = org.apache.commons.logging.impl.LogFactoryImpl

If you want to continue using the default container mechanism, then: β€’ Find and replace the standard logging system implemented in the container with the most modern version β€’ Replace the public bank in the application using ATM adapters. This ensures that the application class loader will delegate the parent component to it when loading LogFactory.

I thought the command "-Dorg.apache.commons ......" would go into the proguard-project.txt file, but this caused the application to not even be able to build. So, on the bottom line, I don’t understand what apache is trying to say, and I hope some of you experienced people can provide some clarity / guidance.

Here's the stack trace:

 07-22 02:49:32.109: E/AndroidRuntime(13589): FATAL EXCEPTION: AsyncTask #1 07-22 02:49:32.109: E/AndroidRuntime(13589): java.lang.RuntimeException: An error occured while executing doInBackground() 07-22 02:49:32.109: E/AndroidRuntime(13589): at android.os.AsyncTask$3.done(AsyncTask.java:299) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 07-22 02:49:32.109: E/AndroidRuntime(13589): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.lang.Thread.run(Thread.java:856) 07-22 02:49:32.109: E/AndroidRuntime(13589): Caused by: aaaab: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'aaaac'. Please check the custom implementation. Help can be found @http://commons.apache.org/logging/troubleshooting.html.) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aaaaca(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aaaaerun(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.security.AccessController.doPrivileged(AccessController.java:45) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aaaaca(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aaaach(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aaaacc(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aabfbb<init>(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at aabfbg<init>(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at toolbox.ea(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at toolbox.e.doInBackground(Unknown Source) 07-22 02:49:32.109: E/AndroidRuntime(13589): at android.os.AsyncTask$2.call(AsyncTask.java:287) 07-22 02:49:32.109: E/AndroidRuntime(13589): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 07-22 02:49:32.109: E/AndroidRuntime(13589): ... 5 more 07-22 02:49:32.109: E/AndroidRuntime(13589): Caused by: java.lang.ClassCastException: The application has specified that a custom LogFactory implementation should be used but Class 'org.apache.commons.logging.impl.LogFactoryImpl' cannot be converted to 'aaaac'. Please check the custom implementation. Help can be found @http://commons.apache.org/logging/troubleshooting.html. 07-22 02:49:32.109: E/AndroidRuntime(13589): ... 17 more 07-22 02:49:32.169: E/(13589): <s3dReadConfigFile:75>: Can't open file for reading 07-22 02:49:32.169: E/(13589): <s3dReadConfigFile:75>: Can't open file for reading 07-22 02:49:32.359: E/SMD(176): DCD ON 07-22 02:49:33.090: E/MP-Decision(1545): DOWN Ld:36 Ns:1.100000 Ts:190 rq:0.400000 seq:196.000000 07-22 02:49:34.191: E/MP-Decision(1545): UP Ld:79 Nw:1.990000 Tw:140 rq:1.700000 seq:147.000000 07-22 02:49:35.353: E/SMD(176): DCD ON 07-22 02:49:36.734: E/Sensors(713): accelHandler -0.001198 -0.114961 10.077044 07-22 02:49:36.944: E/MP-Decision(1545): DOWN Ld:27 Ns:1.100000 Ts:190 rq:0.300000 seq:196.000000 07-22 02:49:38.356: E/SMD(176): DCD ON 07-22 02:49:38.977: E/MP-Decision(1545): UP Ld:36 Nw:1.990000 Tw:140 rq:2.800000 seq:147.000000 07-22 02:49:39.317: E/WifiP2pStateTracker(713): getNetworkInfo : NetworkInfo: type: WIFI_P2P[], state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true 07-22 02:49:39.447: E/ActivityThread(11387): Service com.facebook.katana.platform.PlatformService has leaked ServiceConnection com.facebook.fbservice.ops.DefaultBlu eServiceOperationFactory$DefaultOperation$BlueServiceConnection@ 4235a770 that was originally bound here 07-22 02:49:39.447: E/ActivityThread(11387): android.app.ServiceConnectionLeaked: Service com.facebook.katana.platform.PlatformService has leaked ServiceConnection com.facebook.fbservice.ops.DefaultBlu eServiceOperationFactory$DefaultOperation$BlueServiceConnection@ 4235a770 that was originally bound here 07-22 02:49:39.447: E/ActivityThread(11387): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:965) 07-22 02:49:39.447: E/ActivityThread(11387): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:859) 07-22 02:49:39.447: E/ActivityThread(11387): at android.app.ContextImpl.bindService(ContextImpl.java:1308) 07-22 02:49:39.447: E/ActivityThread(11387): at android.app.ContextImpl.bindService(ContextImpl.java:1300) 07-22 02:49:39.447: E/ActivityThread(11387): at android.content.ContextWrapper.bindService(ContextWrapper.java:401) 07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.f(DefaultBlueServiceOperationFactory.java:426) 07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.a(DefaultBlueServiceOperationFactory.java:384) 07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.katana.platform.PlatformService.b(PlatformService.java:184) 07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.katana.platform.PlatformService.a(PlatformService.java:36) 07-22 02:49:39.447: E/ActivityThread(11387): at com.facebook.katana.platform.PlatformService$MessageHandler.handleMessage(PlatformService.java:71) 07-22 02:49:39.447: E/ActivityThread(11387): at android.os.Handler.dispatchMessage(Handler.java:99) 07-22 02:49:39.447: E/ActivityThread(11387): at android.os.Looper.loop(Looper.java:137) 07-22 02:49:39.447: E/ActivityThread(11387): at android.app.ActivityThread.main(ActivityThread.java:4918) 07-22 02:49:39.447: E/ActivityThread(11387): at java.lang.reflect.Method.invokeNative(Native Method) 07-22 02:49:39.447: E/ActivityThread(11387): at java.lang.reflect.Method.invoke(Method.java:511) 07-22 02:49:39.447: E/ActivityThread(11387): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 07-22 02:49:39.447: E/ActivityThread(11387): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) 07-22 02:49:39.447: E/ActivityThread(11387): at dalvik.system.NativeStart.main(Native Method) 07-22 02:49:39.517: E/Launcher(24512): Error finding setting, default accessibility to not found: accessibility_enabled 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): com.facebook.debug.log.TerribleFailure: Exception unbinding: OperationType{Operation Name=platform_authorize_app, forRemote=false} 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.debug.log.FbLogImpl.f(FbLogImpl.java:147) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.debug.log.FbLogImpl.a(FbLogImpl.java:118) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.debug.log.BLog.a(BLog.java:790) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.e(DefaultBlueServiceOperationFactory.java:362) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.d(DefaultBlueServiceOperationFactory.java:103) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$1.b(DefaultBlueServiceOperationFactory.java:261) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.common.dispose.AbstractListenableDisposable.a(AbstractListenableDisposable.java:34) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.c(DefaultBlueServiceOperationFactory.java:288) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.a(DefaultBlueServiceOperationFactory.java:603) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.b(DefaultBlueServiceOperationFactory.java:561) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.c(DefaultBlueServiceOperationFactory.java:103) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation$4.run(DefaultBlueServiceOperationFactory.java:537) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.os.Handler.handleCallback(Handler.java:615) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.os.Handler.dispatchMessage(Handler.java:92) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.os.Looper.loop(Looper.java:137) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.app.ActivityThread.main(ActivityThread.java:4918) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at java.lang.reflect.Method.invokeNative(Native Method) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at java.lang.reflect.Method.invoke(Method.java:511) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at dalvik.system.NativeStart.main(Native Method) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): Caused by: java.lang.IllegalArgumentException: Service not registered: com.facebook.fbservice.ops.DefaultBlu eServiceOperationFactory$DefaultOperation$BlueServiceConnection@ 4235a770 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:917) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.app.ContextImpl.unbindService(ContextImpl.java:1338) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at android.content.ContextWrapper.unbindService(ContextWrapper.java:412) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): at com.facebook.fbservice.ops.DefaultBlueServiceOperationFactory$DefaultOperation.e(DefaultBlueServiceOperationFactory.java:357) 07-22 02:49:39.667: A/fb4a(:<default>):BlueServiceOperationFactory$Operation(11387): ... 17 more 
+4
source share
1 answer

I ran into the same problem when an external JAR in my project used org.apache.commons.logging.impl.LogFactoryImpl.

It is worth noting that the JAR itself could compile classes from different packages, all of which are in the JAR file. Just open the JAR and take a look.

In the proguard settings file, you must declare all the prefixes in the bank, for example:

 -keep org.apache.** { *; } -keep com.somejar.** { *; } 

Another option would be to tell proguard to completely ignore the entire JAR.

also check: How can I exclude external .jar from obfuscation using Proguard (Android project)?

0
source

Source: https://habr.com/ru/post/1492672/


All Articles