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

Requires Android Oreo or later #16

Closed
dalelane opened this issue Dec 9, 2018 · 10 comments
Closed

Requires Android Oreo or later #16

dalelane opened this issue Dec 9, 2018 · 10 comments
Labels
bug Something isn't working confirmed Issue confirmed

Comments

@dalelane
Copy link
Collaborator

dalelane commented Dec 9, 2018

Tried running something on a second-hand Android device I was able to get hold of, and it crashed with:

12-09 17:03:16.756 11271 11443 E AndroidRuntime: FATAL EXCEPTION: Thread-8
12-09 17:03:16.756 11271 11443 E AndroidRuntime: Process: edu.mit.appinventor.aicompanion3, PID: 11271
12-09 17:03:16.756 11271 11443 E AndroidRuntime: java.lang.NoSuchMethodError: No virtual method toPath()Ljava/nio/file/Path; in class Ljava/io/File; or its super classes (declaration of 'java.io.File' appears in /system/framework/core-oj.jar)
12-09 17:03:16.756 11271 11443 E AndroidRuntime: 	at com.kylecorry.ml4k.ML4K.getImageData(ML4K.java:310)
12-09 17:03:16.756 11271 11443 E AndroidRuntime: 	at com.kylecorry.ml4k.ML4K.access$100(ML4K.java:39)
12-09 17:03:16.756 11271 11443 E AndroidRuntime: 	at com.kylecorry.ml4k.ML4K$1.run(ML4K.java:86)
12-09 17:03:16.756 11271 11443 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:761)
12-09 17:03:16.766   548  1332 W ActivityManager:   Force finishing activity edu.mit.appinventor.aicompanion3/.Screen1

According to threads like osiegmar/FastCSV#16 and https://bitbucket.org/ijabz/jaudiotagger/issues/113/cannot-run-under-android-could-not-find it's because that method isn't available on the version of Android that I have (Android 7.1).

I don't know if there is a way to code around this. If not, it might be worth a warning somewhere to say that the image block needs Android 8 or later.

@kylecorry31
Copy link
Owner

I think I might be able to get around this.

@kylecorry31
Copy link
Owner

So I did some research into this, and I can get by the toPath() issue, but I need the Base64 encoder for images, which was added in Android 8 as well (https://developer.android.com/reference/java/util/Base64). I could write my own base64 encoder in the future (I've written one before and it was slow - don't think I have the code for it anymore).

I am on break from college in a week, so I will add a workaround then. (Android allows you to check the API version and I can run the efficient code on new devices and the custom code on old devices)

@dalelane
Copy link
Collaborator Author

dalelane commented Dec 9, 2018

@kylecorry31 That's awesome news, thanks!

@kylecorry31 kylecorry31 added bug Something isn't working confirmed Issue confirmed labels Dec 9, 2018
@kylecorry31
Copy link
Owner

kylecorry31 commented Dec 23, 2018

@dalelane This issue should now be resolved with the latest release (and the master branch's release/ folder has been updated)

Could you test the latest version on the Android 7.1 device for me? I am going to mark this issue as closed for now, as it appears all of the offending code has backfills now.

dalelane added a commit to IBM/taxinomitis that referenced this issue Dec 24, 2018
Contributes to: kylecorry31/ML4K-AI-Extension#16

Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
@dalelane
Copy link
Collaborator Author

@kylecorry31 Thanks for doing this! (I've not had a chance to test it yet, but will let you know when I do)

@dalelane
Copy link
Collaborator Author

dalelane commented Jan 6, 2019

@kylecorry31 Sorry for taking so long to get to this - Christmas got in the way :-)

I'm still not having much luck. I was trying to use an image classifier.

If I use the Camera, then the data seems to be missing from the classification request. (I just got a HTTP 400 Missing data error response)

If I use the Image Picker, I get a crash

AndroidRuntime: FATAL EXCEPTION: Thread-9
AndroidRuntime: Process: edu.mit.appinventor.aicompanion3, PID: 4426
AndroidRuntime: java.lang.NoSuchMethodError: No static method toUnsignedInt(B)I in class Ljava/lang/Byte; or its super classes (declaration of 'java.lang.Byte' appears in /system/framework/core-oj.jar)
AndroidRuntime: 	at com.kylecorry.ml4k.ML4K$Base64Encoder.encode(ML4K.java:452)
AndroidRuntime: 	at com.kylecorry.ml4k.ML4K.getImageData(ML4K.java:320)
AndroidRuntime: 	at com.kylecorry.ml4k.ML4K.access$100(ML4K.java:40)
AndroidRuntime: 	at com.kylecorry.ml4k.ML4K$1.run(ML4K.java:91)
AndroidRuntime: 	at java.lang.Thread.run(Thread.java:761)

@dalelane
Copy link
Collaborator Author

dalelane commented Jan 6, 2019

Have you tried doing a project using the Camera, without needing to take a picture and then go via the Image Picker?

That's a sort of side issue I guess though, as it looks like the Base64-encoding would be a problem either way.

@kylecorry31 kylecorry31 reopened this Jan 6, 2019
@kylecorry31
Copy link
Owner

Hello, thanks for the update. I have attached an extension file which should fix that "no static method" issue - please let me know if that fixes the issue.
ML4K.zip

I will look into the camera issue, thanks

@dalelane
Copy link
Collaborator Author

dalelane commented Jan 6, 2019

@kylecorry31 That did the trick with the Image Picker - thanks!

@kylecorry31
Copy link
Owner

Awesome, thanks!

kylecorry31 added a commit that referenced this issue Jan 7, 2019
Update Base64Encoder to close #16
dalelane added a commit to IBM/taxinomitis that referenced this issue Jan 12, 2019
Contributes to: kylecorry31/ML4K-AI-Extension#16

Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Issue confirmed
Projects
None yet
Development

No branches or pull requests

2 participants