ERROR: Failed to resolve: com.serenegiant:common:2.12.4

集成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方式

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章