集成UVCCamera 報錯
問題1
ERROR: Failed to resolve: com.serenegiant:common:2.12.4
Show in Project Structure dialog
這個報錯主要是找不到依賴
打開根目錄的build.gradle 添加如下代碼(檢查下添加的內容 是否有)即可(根目錄的build.gradle)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
/**
* 添加的內容
*/
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
/**
* 添加的內容
*/
maven { url 'https://maven.google.com' }
google()
jcenter()
/**
* 添加的內容
*/
maven { url 'http://raw.github.com/saki4510t/libcommon/master/repository/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
supportLibVersion = '27.1.1' // variable that can be referenced to keep support libs consistent
commonLibVersion= '2.12.4'
versionBuildTool = '27.0.3'
versionCompiler = 27
versionTarget = 27
versionNameString = '1.0.0'
javaSourceCompatibility = JavaVersion.VERSION_1_8
javaTargetCompatibility = JavaVersion.VERSION_1_8
}
對比對照下“重點添加的內容”這幾條是否有 ,沒有的添加進去,同步一下即可
問題2
Cannot access com.sereneginat.dialog.MessageDialogFragmentV4.MessageDialogListener
添加依賴後,使用BaseActivity提示錯誤,造成這個原因是lib依賴中使用的implementation依賴 在其他包中是不對外開放的,改成api方式依賴即可
即把 libuvccamera和usbCameraCommon 的build.gradle文件下的
implementation("com.serenegiant:common:${commonLibVersion}") {
exclude module: 'support-v4'
}
改成
api("com.serenegiant:common:${commonLibVersion}") {
exclude module: 'support-v4'
}
重點:把implementation依賴方式改成api方式