1、NDK报错:Process 'command 'D:\SDK\ndk-bundle/ndk-build.cmd'' finished with non-zero exit value 2

解决方法:ndk版本过高,需要下载16.1.4479499版本的ndk,并在local.properties里写入以下三个路径,根据自己的安装目录填写

2、common-2.12.4.aar下载不了

解决方法:我把它上传到百度盘了

链接:https://pan.baidu.com/s/1cVjoRYgGNuPlTq5PqcvkgQ 
提取码:1omu

在所有项目下的build.gradle里注释掉

implementation("com.serenegiant:common:${commonLibVersion}") { exclude module: 'support-v4' }

将common-2.12.4.aar复制到libuvccamera的libs文件夹里面,不是jni那个libs

将libuvccamera里的build.gradle里的

implementation fileTree(dir: new File(buildDir, 'libs'), include: ['*.jar'])

改为implementation fileTree(dir: new File(buildDir, 'libs'), include: ['*.jar','*.aar'])

3、有些例子缺少v7库

解决方法:

在build.gradle添加implementation "com.android.support:appcompat-v7:27+"

4、主题错误,在style里改成Theme.AppCompat.Light.DarkActionBar

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

5、java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable

解决方法:7.0以后,TexureView不需要设置背景,去掉background属性

<com.serenegiant.widget.SimpleUVCCameraTextureView
    android:id="@+id/UVCCameraTextureView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="#ff000000" />

改成

<com.serenegiant.widget.SimpleUVCCameraTextureView
    android:id="@+id/UVCCameraTextureView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    />

6、打开摄像头时出现could not open camera:err=-1

在Application.mk里把

#NDK_TOOLCHAIN_VERSION := 4.9

改为

NDK_TOOLCHAIN_VERSION := 4.9

 

 

 

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐