[uvvccamera / novice] Android Studio Compiling & stepping on the pit

  • In the front

Android Studio version: 3.2

Operating system (AS): Windows10

Android version: 5.0.2

Camera: USB camera (640 * 480 spicy chicken)

Open source projects: saki4510t/UVCCamera

  • Compile process

1. Install Android Studio

http://www.android-studio.org/

(it seems that sometimes you can't download the SDK in the software after installation. I don't know why, and there seems to be no problem under Linux.)

2. Download source code

https://github.com/saki4510t/UVCCamera

3. Open project

4. Open the outermost build.gradle file

Note the version numbers here:

Supportlibversion ='27.1.1 '/ / the large version should be consistent with the versionCompiler

Commonlibversion ='2.12.4 '/ / temporarily ignored

versionBuildTool = '28.0.3' / / select the one installed in Android SDK build tool in SDK tools, as shown in the following figure

versionCompiler = 27 / / these two seem to be larger than 26. Select the following figure. If not, install them (tick - > apply)

versionTarget = 27

5.  Sync Project

 

6. Installation of NDK

Do not use SDK Manager to install here. Go to the official website to download NDK14

https://developer.android.google.cn/ndk/downloads/index.html

After downloading, extract it to the PATH/Android/Sdk directory (you can change the folder name)

 

7. Configure NDK

Open the file local.properties

 

File->Project Structure

8.  build 

9.  Run

The following errors may occur:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.serenegiant.usbcameratest0, PID: 12421
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.serenegiant.usbcameratest0/com.serenegiant.usbcameratest0.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
        at android.app.ActivityThread.access$800(ActivityThread.java:144)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5221)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:354)
        at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at com.serenegiant.usbcameratest0.MainActivity.onCreate(MainActivity.java:61)
        at android.app.Activity.performCreate(Activity.java:5933)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
        at android.app.ActivityThread.access$800(ActivityThread.java:144) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:135) 
        at android.app.ActivityThread.main(ActivityThread.java:5221) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:372) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 

Need to

Change to "Android: theme" = "@ style / theme. Approve. Light. Noactionbar"

 

  • Other errors
E/UVCCamera: [30452*UVCCamera.cpp:172:connect]:could not open camera:err=-1
Process 'command '/root/Android/Sdk/ndk-bundle/ndk-build'' 
finished with non-zero exit value 2

Both of the above errors need to change the NDK version to 14

  • Test8 screenshots

 

END

Tags: Java Android SDK Linux

Posted on Tue, 03 Dec 2019 15:30:45 -0500 by philooo