flutter 依赖的组件无法加载 FAILURE: Build failed with an exception.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.10/kotlin-stdlib-jdk8-1.8.10.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.android.installreferrer:installreferrer:2.2.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/android/installreferrer/installreferrer/2.2/installreferrer-2.2.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.android.billingclient:billing:4.1.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/android/billingclient/billing/4.1.0/billing-4.1.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.google.code.gson:gson:2.11.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/google/code/gson/gson/2.11.0/gson-2.11.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.umeng.umsdk:common:9.7.7.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/umeng/umsdk/common/9.7.7/common-9.7.7.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.umeng.umsdk:asms:1.8.3.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/umeng/umsdk/asms/1.8.3/asms-1.8.3.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find io.openim:core-sdk:2.3.3.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/io/openim/core-sdk/2.3.3/core-sdk-2.3.3.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.huawei.hms:ads-identifier:3.4.39.302.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/huawei/hms/ads-identifier/3.4.39.302/ads-identifier-3.4.39.302.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.appsflyer:af-android-sdk:6.2.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/appsflyer/af-android-sdk/6.2.0/af-android-sdk-6.2.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.huawei.hms:push:6.13.0.300.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/com/huawei/hms/push/6.13.0.300/push-6.13.0.300.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find cn.jiguang.sdk.plugin:huawei:5.6.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/cn/jiguang/sdk/plugin/huawei/5.6.0/huawei-5.6.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find cn.jiguang.sdk.plugin:xiaomi:5.6.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/cn/jiguang/sdk/plugin/xiaomi/5.6.0/xiaomi-5.6.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find cn.jiguang.sdk.plugin:meizu:5.6.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/cn/jiguang/sdk/plugin/meizu/5.6.0/meizu-5.6.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find cn.jiguang.sdk.plugin:vivo:5.6.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/cn/jiguang/sdk/plugin/vivo/5.6.0/vivo-5.6.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find cn.jiguang.sdk.plugin:oppo:5.6.0.
     Searched in the following locations:
       - https://storage.flutter-io.cn/download.flutter.io/cn/jiguang/sdk/plugin/oppo/5.6.0/oppo-5.6.0.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app
   > Could not find com.google.code.gson:gson:2.11.0.
     Searched in the following locations:
     Required by:
         project :app

* 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.

* Get more help at https://help.gradle.org

settings.gradle

pluginManagement {
    def flutterSdkPath = {
        def properties = new Properties()
        file("local.properties").withInputStream { properties.load(it) }
        def flutterSdkPath = properties.getProperty("flutter.sdk")
        assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
        return flutterSdkPath
    }()

    includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

    repositories {
        gradlePluginPortal()
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
        // 优先使用阿里云镜像(国内加速)
        maven { url 'https://maven.aliyun.com/repository/public/' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
        maven { url 'https://maven.aliyun.com/repository/google/' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
//        maven { url "https://storage.flutter-io.cn/download.flutter.io" }
        maven { url 'https://jitpack.io' }

        // OpenIM Meven (修改为下面的配置,明文ip官方废弃了)
//        maven { url 'https://open-im-online.rentsoft.cn:51000/repository/maven2/' }

        // 配置HMS Core SDK的Maven仓地址。
        maven { url 'https://developer.huawei.com/repo/' }
        //荣耀推送
        maven { url 'https://developer.hihonor.com/repo' }

    }
}
//依赖仓库管理
dependencyResolutionManagement {
    //FAIL_ON_PROJECT_REPOS 表示禁止子模块单独声明仓库,强制使用此处统一配置(若模块自行添加仓库,构建将失败)
    //PREFER_PROJECT 允许项目级别的仓库配置优先于settings级别的配置,从而解决冲突
    repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
    repositories {
        google()
        mavenLocal()
        mavenCentral()
        jcenter()
        // 优先使用阿里云镜像(国内加速)
        maven { url 'https://maven.aliyun.com/repository/public/' }
        maven { url 'https://maven.aliyun.com/repository/central' }
        maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
        maven { url 'https://maven.aliyun.com/repository/google/' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
//        maven { url "https://storage.flutter-io.cn/download.flutter.io" }

        // OpenIM Meven (修改为下面的配置,明文ip官方废弃了)
//        maven { url 'https://open-im-online.rentsoft.cn:51000/repository/maven2/' }
        // 配置HMS Core SDK的Maven仓地址。
        maven { url 'https://developer.huawei.com/repo/' }
        //荣耀推送
        maven { url 'https://developer.hihonor.com/repo' }

    }
}


include ':app'

android/build.gradle

buildscript {
    ext.kotlin_version = '1.8.10'
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        //华为推送-极光
        classpath 'com.huawei.agconnect:agcp:1.9.1.301'
        //荣耀推送-极光
        classpath 'com.hihonor.mcs:asplugin:2.0.0'
//        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "com.huawei.agconnect"
    id 'org.jetbrains.kotlin.android'
    id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

static def time() {
    return new Date().format("yyyyMMdd_HH_mm", TimeZone.getDefault())
}

android {
//    namespace  "com.family.tree"
    //compileSdkVersion flutter.compileSdkVersion
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
//修改JVM目标版本‌
    kotlinOptions {
        jvmTarget = 17
    }
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.family.tree"
        // You can update the following values to match your application needs. 
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        //minSdkVersion flutter.minSdkVersion
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        if (isDebugApp.toBoolean()) {
            ndk {
//            //选择要添加的对应 cpu 类型的 .so 库。
//            //安卓平台-32位/64位兼容('armeabi', 'armeabi-v7a', 'arm64-v8a')
//            abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'
                //安卓平台-32位('armeabi', 'armeabi-v7a')
//            abiFilters 'armeabi', 'armeabi-v7a'
                //安卓平台-64位('arm64-v8a')
                abiFilters 'arm64-v8a'
                //windows平台('x86', 'x86_64', 'mips', 'mips64')
//            abiFilters  'x86', 'x86_64', 'mips', 'mips64'
                //模拟器专用('x64')
//            abiFilters 'x64'
            }
        }

    buildTypes {
        debug {
            signingConfig signingConfigs.forAll
            minifyEnabled false //删除无用代码
            shrinkResources false //删除无用资源
            zipAlignEnabled true  // Zipalign优化
        }
        profile {
            signingConfig signingConfigs.forAll
            minifyEnabled false //删除无用代码
            shrinkResources false //删除无用资源
            zipAlignEnabled true  // Zipalign优化
        }
        release {
            signingConfig signingConfigs.forAll
            minifyEnabled false //删除无用代码
            shrinkResources false //删除无用资源
            zipAlignEnabled true  // Zipalign优化
        }
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
    lintOptions {
        baseline file("lint-baseline.xml")
    }

    if (!isDebugApp.toBoolean()) {
        //打包不同版本时下面注释的代码放出来
        applicationVariants.all { variant ->
            variant.outputs.all {
                outputFileName = "family_${variant.flavorName}_v${variant.productFlavors.get(0).versionName}_${variant.productFlavors.get(0).versionCode}_${time()}_${variant.buildType.name}.apk"
            }
        }
        //指定多环境打包依据(依据productFlavors中哪个条件去打包)
        flavorDimensions "default"
        /**
         * 多渠道打包
         */
        productFlavors {
            v_high {
                //高版本  versionCode_low(低版本)  versionName_low(低版本)
                versionCode flutterVersionCode.toInteger()
                versionName flutterVersionName
                ndk {
                    abiFilters "armeabi"
                    abiFilters "armeabi-v7a"
                    abiFilters "arm64-v8a"
                }
            }

            v_low {
                //低版本
                versionCode 1
                versionName "1.0.0"
                ndk {
                    abiFilters "armeabi"
                    abiFilters "armeabi-v7a"
                    abiFilters "arm64-v8a"
                }
            }

            v_x32 {
                versionCode flutterVersionCode.toInteger()
                versionName flutterVersionName
                //#这里定义armv7版本的特性 32位
                ndk {
                    abiFilters "armeabi"
                    abiFilters "armeabi-v7a"
                }
            }

            v_x64 {
                versionCode flutterVersionCode.toInteger()
                versionName flutterVersionName
                //#这里定义arm64-v8a版本的特性 64位
                ndk {
                    abiFilters "arm64-v8a"
                }
            }

        }
    }
    //全局约束,强制所有插件降级处理
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                android {
                    compileOptions {
                        sourceCompatibility JavaVersion.VERSION_17
                        targetCompatibility JavaVersion.VERSION_17
                    }
                }
            }
        }
    }
}

flutter {
    source '../..'
}

//repositories {
//    flatDir {
//        dirs 'libs'
//    }
//}

dependencies {
    //配置appsflyer_sdk
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test:runner:1.4.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation 'com.android.installreferrer:installreferrer:2.2'
    implementation 'com.android.billingclient:billing:4.1.0'
    implementation 'com.google.code.gson:gson:2.11.0'
    // 友盟统计SDK
    implementation 'com.umeng.umsdk:common:9.7.7'// 必选
    implementation 'com.umeng.umsdk:asms:1.8.3'// 必选

    //implementation 'io.openim:core-sdk:2.2.0@aar'
    implementation 'io.openim:core-sdk:2.3.3@aar'
    implementation 'com.huawei.hms:ads-identifier:3.4.39.302'
    //配置appsflyer_sdk
    implementation 'com.appsflyer:af-android-sdk:6.2.0'

    //华为推送-极光-JPush
    implementation 'com.huawei.hms:push:6.13.0.300'
    //华为推送-极光-厂商版本和 JPush SDK 版本保持一致
    implementation 'cn.jiguang.sdk.plugin:huawei:5.6.0'

    //小米推送-极光-厂商版本和 JPush SDK 版本保持一致
    implementation 'cn.jiguang.sdk.plugin:xiaomi:5.6.0'

    //MEZU推送-极光-厂商版本和JPush SDK版本保持一致
    implementation 'cn.jiguang.sdk.plugin:meizu:5.6.0'
    // JPush Android SDK v5.2.3 开始,需要单独引入 魅族 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/meizu/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
    implementation files('libs/push-internal-5.0.3.aar')

    //VIVO推送-极光-厂商版本和 JPush SDK 版本保持一致
    implementation 'cn.jiguang.sdk.plugin:vivo:5.6.0'

    //OPPO推送-极光-
    implementation 'cn.jiguang.sdk.plugin:oppo:5.6.0'
    // JPush Android SDK v4.6.0 开始,需要单独引入 oppo 厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/oppo/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
    implementation files('libs/com.heytap.msp_3.5.3.aar')
    //以下为 OPPO 3.1.0 aar需要依赖
    implementation 'com.google.code.gson:gson:2.10.1'
    implementation 'commons-codec:commons-codec:1.6'
    implementation 'androidx.annotation:annotation:1.1.0'

    //接入荣耀推送-极光
    implementation 'cn.jiguang.sdk.plugin:honor:5.6.0'
    //需要单独引入荣耀厂商 aar ,请下载官网 SDK 包并把 jpush-android-xxx-release/third-push/honor/libs 下的 aar 文件单独拷贝一份到应用 module/libs 下
    implementation files('libs/HiPushSDK-8.0.12.307.aar')
}
configurations {
    all*.exclude group: 'com.google.firebase', module: 'firebase-common'  //exclude排除某项库
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值