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

Doc: suggest adding these steps for Android Studio #9

Open
markdeaton opened this issue Apr 26, 2021 · 5 comments
Open

Doc: suggest adding these steps for Android Studio #9

markdeaton opened this issue Apr 26, 2021 · 5 comments

Comments

@markdeaton
Copy link

markdeaton commented Apr 26, 2021

Here are some steps I needed to perform in getting the app to compile in Android Studio; not all of them are obvious; documenting them might save others some time.

  1. Download old Android ndk r15c
  2. Add to local.properties: ndk.dir=c:\\android\\sdk\\ndk\\android-ndk-r15c
  3. Desktop module build.gradle, line 32 change ".classesDir" to ".classesDirs"
  4. Download OpenCV 3.3.1 https://github.com/opencv/opencv/archive/3.3.1.zip and extract it into the top directory of the project
  5. Copy android/src/main/jni/TEMPLATE_Android.mk to Android.mk
  6. In Android.mk set OPENCVROOT var to the OpenCV SDK 3.3.1 downloaded above (e.g. C:/Projects/Android/Panorama360/OpenCV-android-sdk)
@cybenauts
Copy link

Thank you for your suggestions, I am able to build the app, but getting the following error when the activity opens

05-18 19:21:50.841 20496-20496/study.acodexm E/AndroidRuntime: FATAL EXCEPTION: main Process: study.acodexm, PID: 20496 java.lang.NoSuchMethodError: No static method stream([Ljava/lang/Object;)Ljava/util/stream/Stream; in class Ljava/util/Arrays; or its super classes (declaration of 'java.util.Arrays' appears in /system/framework/core-libart.jar) at study.acodexm.f.t.a(Unknown Source) at study.acodexm.MainActivity.t(Unknown Source) at study.acodexm.MainActivity.onCreate(Unknown Source) at android.app.Activity.performCreate(Activity.java:6316) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2421) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2530) at android.app.ActivityThread.access$1100(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5600) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

@markdeaton
Copy link
Author

@salamay
Copy link

salamay commented Jul 28, 2021

Thank you for your suggestions, I am able to build the app, but getting the following error when the activity opens

05-18 19:21:50.841 20496-20496/study.acodexm E/AndroidRuntime: FATAL EXCEPTION: main Process: study.acodexm, PID: 20496 java.lang.NoSuchMethodError: No static method stream([Ljava/lang/Object;)Ljava/util/stream/Stream; in class Ljava/util/Arrays; or its super classes (declaration of 'java.util.Arrays' appears in /system/framework/core-libart.jar) at study.acodexm.f.t.a(Unknown Source) at study.acodexm.MainActivity.t(Unknown Source) at study.acodexm.MainActivity.onCreate(Unknown Source) at android.app.Activity.performCreate(Activity.java:6316) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2421) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2530) at android.app.ActivityThread.access$1100(ActivityThread.java:154) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5600) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Here are some steps I needed to perform in getting the app to compile in Android Studio; not all of them are obvious; documenting them might save others some time.

  1. Download old Android ndk r15c
  2. Add to local.properties: ndk.dir=c:\android\sdk\ndk\android-ndk-r15c
  3. Desktop module build.gradle, line 32 change ".classesDir" to ".classesDirs"
  4. Download OpenCV 3.3.1 https://github.com/opencv/opencv/archive/3.3.1.zip and extract it into the top directory of the project
  5. Copy android/src/main/jni/TEMPLATE_Android.mk to Android.mk
  6. In Android.mk set OPENCVROOT var to the OpenCV SDK 3.3.1 downloaded above (e.g. C:/Projects/Android/Panorama360/OpenCV-android-sdk)

I didn't understand the 5th step

@markdeaton
Copy link
Author

@salamay Step 5 refers to the source code for this git: https://github.com/acodexm/Panorama360/tree/master/android/src/main/jni

In that directory, currently there's Application.mk and TEMPLATE_Android.mk. I'm suggesting you copy TEMPLATE_Android.mk to the same directory and rename it "Android.mk" because that's the NDK build system seems to be looking for (not "Application.mk").

@salamay
Copy link

salamay commented Jul 29, 2021

@salamay Step 5 refers to the source code for this git: https://github.com/acodexm/Panorama360/tree/master/android/src/main/jni

In that directory, currently there's Application.mk and TEMPLATE_Android.mk. I'm suggesting you copy TEMPLATE_Android.mk to the same directory and rename it "Android.mk" because that's the NDK build system seems to be looking for (not "Application.mk").

Thanks... It has compiled.....but i don't know how to operate the app... It doesn't seam to capture any photo in any mode

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

No branches or pull requests

3 participants