Skip to content
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

Android18Instantiator Fails On Android O #52

Closed
erandagan opened this issue May 27, 2017 · 6 comments
Closed

Android18Instantiator Fails On Android O #52

erandagan opened this issue May 27, 2017 · 6 comments
Assignees
Milestone

Comments

@erandagan
Copy link

It seems that Android18Instantiator does not work on Android O beta (SDK level 25).
Looks like Android dropped support for ObjectStreamClass.getConstructorId

Caused by java.lang.UnsupportedOperationException: ObjectStreamClass.getConstructorId(Class<?>) is not supported on SDK 25
       at java.io.ObjectStreamClass.getConstructorId(ObjectStreamClass.java:2294)
       at java.lang.reflect.Method.invoke(Method.java)
       at org.objenesis.instantiator.android.Android18Instantiator.findConstructorIdForJavaLangObjectConstructor(Android18Instantiator.java:72)
       at org.objenesis.instantiator.android.Android18Instantiator.(Android18Instantiator.java:39)
       at org.objenesis.strategy.StdInstantiatorStrategy.newInstantiatorOf(StdInstantiatorStrategy.java:96)
...
@henri-tremblay henri-tremblay self-assigned this May 28, 2017
@henri-tremblay henri-tremblay added this to the 2.6 milestone May 28, 2017
@henri-tremblay
Copy link
Contributor

They love to make my life complicated. :-) Thanks for reporting. I will look into it. The fix should be out soon.

@henri-tremblay
Copy link
Contributor

@erandagan Stupid question. I'm looking for the Android O SDK and system image to run with AVD. Can you help me?

@erandagan
Copy link
Author

erandagan commented Jun 4, 2017

@henri-tremblay Sure, I'll see if I can find it. I got the stack traces from my app's users who installed the O Beta on their devices.

@westnordost
Copy link

The Android O System Image for the Android Emulator is listed in the SDK manager under Android O Preview as Google APIs Intel x86 Atom System Image. But only for the Android Studio 3.0.
See https://developer.android.com/preview/migration.html#pct

If you have Android Studio already installed, you can change to the canary channel to (probably?) update to 3.0. See https://developer.android.com/studio/intro/update.html##sdk-manager

@henri-tremblay
Copy link
Contributor

Thanks. I was using the Android plugin on IntelliJ Ultimate. Always disappointing to see that there are so much things missing in it. But yes, using Android Studio Canary made it appear. So I'm almost there now.

@henri-tremblay
Copy link
Contributor

I just realized something. You are not supposed to use Android18Instantiator anymore. Latest Android versions (N and O) are based on the OpenJDK and so are using the UnsafeFactoryInstantiator. This is the one StdInstantiatorStrategy will give you.

So I just tested it on Android O and it works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants