-
Notifications
You must be signed in to change notification settings - Fork 49
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
java.lang.NoClassDefFoundError: androidx/lifecycle/LifecycleOwner (J2X9001) #47
Comments
@hadigityat Another one: |
@moljac It doesn't complain about the LifecycleOwner class when using class-parse but is it because class-parse is using bytecode directly? |
@hadigityat I think (if I recall correctly) that |
java Can you disable linking? |
@moljac Bindings project doesn't allow you to change the linking through project options. How can I disable it? |
Do you have application? Unit tests? I think I'll need minimal repro sample for this issue. |
I get it when I create a Bindings Library and build the project with an aar file. No unit tests. Not sure if I can share the code, it is a third party library. The interesting thing is I do not see LifeCycleOwner being referenced anywhere. I just few other builds and the lifecycle warnings are gone. Would the LifecycleOwner vs ILifecycleOwner create issues? |
https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner
I get it, but it would be easier to analyze.
Library could use it (in java world). If you cannot provide sample I will have to close this issue. |
We are preparing stable release. If this issue persist create new one and provide minimal sample (maybe private repo if you want). |
I am having this problem too. I'm trying to port a library made on AndroidX and I'm getting this error. JARTOXML: Warning J2X9001: Couldn't load class com/combateafraude/documentdetector/DocumentDetectorActivity : java.lang.NoClassDefFoundError: androidx/lifecycle/LifecycleOwner |
Archive.zip |
@matheussouza97 |
forget it. My bad. Wrong project. Too much to do. |
I cannot repro this issue:
|
OK. Found it. But it is a warning. Does it produce a crash? @jpobst Can you look at it, please? Repro sample is here. |
@hadigityat @matheussouza97 Guys switch to |
@matheussouza97 wrote:
The problem is twofold:
Look at the complete error message:
In particular, note the
The problem is that % jar tf Jars/document-detector-1.0.0/classes.jar | grep Status
# no output The fix is to use <AndroidClassParser>class-parse</AndroidClassParser> This has also been the default for new projects for...years? (Awhile.) This allows <class
abstract="false"
deprecated="not deprecated"
jni-extends="Ljava/lang/Object;"
extends="java.lang.Object"
extends-generic-aware="java.lang.Object"
final="false"
name="DocumentDetectorController"
jni-signature="Lcom/combateafraude/documentdetector/controller/DocumentDetectorController;"
source-file-name=""
static="false"
visibility="public">
<implements
name="com.combateafraude.helpers.camera.CameraHelperCallback"
name-generic-aware="com.combateafraude.helpers.camera.CameraHelperCallback"
jni-type="Lcom/combateafraude/helpers/camera/CameraHelperCallback;" />
... Unfortunately, that's not enough for it to be bound; we get a different build message:
This is the "same" error as with ...then we hit other complexities ("bugs") in our toolchain, such that Still, the J2X9001 warning isn't emitted... |
Sorry for taking your time, switching to class-parse worked perfectly! |
Xamarin.Android Version (eg: 6.0):
Xamarin.Android
Version: 10.1.3.7 (Visual Studio Community)
Commit: xamarin-android/d16-4/d66aed0
Operating System & Version (eg: Mac OSX 10.11):
Mac OS X 10.15.2
Darwin 19.2.0 Darwin Kernel Version 19.2.0
Support Libraries Version (eg: 23.3.0):
Xamarin.AndroidX.Lifecycle.Common(2.1.0-preview06)
also tried (2.1.0-rc1)
Describe your Issue:
JARTOXML: Warning J2X9001: Couldn't load class ...: java.lang.NoClassDefFoundError: androidx/lifecycle/LifecycleOwner (J2X9001)
JARTOXML: Warning J2XA006: missing class error was raised while reflecting ... : androidx/lifecycle/LifecycleOwner (J2XA006)
Steps to Reproduce (with link to sample solution if possible):
Create a xamarin bindings project and bind java lib using jar2xml
Include any relevant Exception Stack traces, build logs, adb logs:
The text was updated successfully, but these errors were encountered: