Android使用UVCCamera打开USBCamera-编译

  1. 下载源码
    https://github.com/saki4510t/UVCCamera

  2. NDK编译错误

    Execution failed for task ':libuvccamera:ndkClean'.
    > Process 'command 'D:\android-ndk-r22b-windows-x86_64\android-ndk-r22b/ndk-build.cmd'' finished with non-zero exit value 2
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    
    

    NDK版本过高,我这边使用r12版本,下载地址
    https://github.com/android/ndk/wiki/Unsupported-Downloads
    在local.properties文件后添加

    ndk.dir=D\:\\android-ndk-r12b-windows-x86_64\\android-ndk-r12b
    
  3. libcommon库问题

    			Could not resolve all dependencies for configuration ':usbCameraTest:debugRuntimeClasspath'.
    			Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven9(http://raw.github.com/saki4510t/libcommon/master/repository/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.4/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 
    	
    

    直接删除下面引用,后面根据编译报错删除HandlerThreadHandler和BuildCheck相关API的调用,不影响后面使用

    	implementation ("com.serenegiant:common:${commonLibVersion}") {
    		exclude module: 'support-v4'
    	}
    
  4. 修改build.gradle文件

    buildscript {
        repositories {
    //		google()
    		maven { setUrl("https://maven.aliyun.com/repository/central") }
    		maven { setUrl("https://maven.aliyun.com/repository/jcenter") }
    		maven { setUrl("https://maven.aliyun.com/repository/google") }
    		maven { setUrl("https://maven.aliyun.com/repository/gradle-plugin") }
    		maven { setUrl("https://maven.aliyun.com/repository/public") }
    		maven { setUrl("https://jitpack.io") }
    		maven { setUrl("https://maven.aliyun.com/nexus/content/groups/public/") }
    		maven { setUrl("https://maven.aliyun.com/nexus/content/repositories/jcenter") }
    		gradlePluginPortal()
    		google()
    		mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:4.2.2'
        }
    }
    
    allprojects {
        repositories {
    //    	google()
    		maven { setUrl("https://maven.aliyun.com/repository/central") }
    		maven { setUrl("https://maven.aliyun.com/repository/jcenter") }
    		maven { setUrl("https://maven.aliyun.com/repository/google") }
    		maven { setUrl("https://maven.aliyun.com/repository/gradle-plugin") }
    		maven { setUrl("https://maven.aliyun.com/repository/public") }
    		maven { setUrl("https://jitpack.io") }
    		maven { setUrl("https://maven.aliyun.com/nexus/content/groups/public/") }
    		maven { setUrl("https://maven.aliyun.com/nexus/content/repositories/jcenter") }
    		gradlePluginPortal()
    		google()
    		mavenCentral()
    }
    
  5. 执行后生成libuvccamera\build\outputs\aar\libuvccamera-release.aar
    在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值