hch
2022-07-24 5df1bf87b902f9b5f3a825822f554ad8a9ee368e
SdkProject/library/build.gradle
@@ -32,14 +32,17 @@
def channelJavaFiles = getAllFiles(new ArrayList<File>(), "${channelPath}/java")
android {
    compileSdkVersion 29
    buildToolsVersion "28.0.1"
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        //noinspection ExpiredTargetSdkVersion
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        versionCode 6
        versionName "6.0"
//        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles "consumer-rules.pro"
@@ -98,11 +101,7 @@
                java.srcDirs "${pluginPath}/java"
                jniLibs.srcDirs "${pluginPath}libs"
                res.srcDirs "${pluginPath}/res"
                manifest {
                    File file = file("${pluginPath}/AndroidManifest.xml")
                    if (file.exists())
                        srcFile "${pluginPath}/AndroidManifest.xml"
                }
                //清单只能合并一个,所有插件的清单需要手动复制到对应的渠道里
            }
        }
    }
@@ -142,12 +141,13 @@
}
task deleteSdk() {
    delete "${outPutPath}\\${CHANNEL_NAME}"
    delete "${outPutPath}\\${CHANNEL_NAME}\\debug"
    delete "${outPutPath}\\${CHANNEL_NAME}\\release"
}
//执行打包任务以及拷贝到外部
task assembleAndCopySdk() {
    dependsOn 'assembleMerger'
    dependsOn 'assemble'
    dependsOn deleteSdk
    dependsOn copyDebugSdk
    dependsOn copyReleaseSdk
@@ -165,14 +165,18 @@
    }
    plugins.each {
        deps = file("${rootPath}/plugins/${it}/deps.gradle")
        deps.eachLine { line ->
            if (line != null)
                content += line + "\n"
        if(deps.exists()){
            deps.eachLine { line ->
                if (line != null)
                    content += line + "\n"
            }
        }
    }
    def dir = new File("${outPutPath}\\${CHANNEL_NAME}")
    def libraries = new File("${outPutPath}\\${CHANNEL_NAME}\\deps.gradle")
    dir.mkdir()
    if (libraries.exists())
        libraries.delete()
    if (!libraries.exists())
        libraries.createNewFile()
    libraries.text = content
@@ -180,14 +184,17 @@
dependencies {
    implementation 'com.android.support:support-annotations:28.0.0'
    testImplementation 'junit:junit:4.13.1'
    testImplementation 'junit:junit:4.13.2'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
//    implementation 'com.android.support:appcompat-v7:28.0.0'
//    implementation 'com.github.pqpo:Log4a:1.4.2@aar'
    implementation fileTree(dir: "../channel/${CHANNEL_NAME}/libs/", include: ['*.jar'])
    plugins.each {
        implementation fileTree(dir: "${rootPath}/plugins/${it}/libs/", include: ['*.jar'])
    }
    implementation fileTree(dir: 'libs', include: ['*.jar'], exclude: ['unity-classes.jar'])
    compileOnly files('libs/unity-classes.jar')
}