Android 此功能需要 ASM7

2024-01-31

可能重复 https://stackoverflow.com/questions/68709559/nestmember-requires-asm7?noredirect=1

我已将 Android Studio 更新为

'Android Studio Arctic Fox | 2020.3.1 Patch 3'

Java从jdk 1.8更新到jdk 11

compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }


kotlinOptions {
        jvmTarget = '11'
    }

我也将 gradle 升级到

'com.android.tools.build:gradle:7.0.3'

这是我完整的 gradle 构建文件

摇篮(模块)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
    id 'androidx.navigation.safeargs.kotlin'
    id 'kotlin-kapt'
    id 'io.michaelrocks.paranoid'
    id 'com.google.gms.google-services'
    id 'com.google.firebase.crashlytics'
}

android {

    compileSdk 32

    defaultConfig {
        applicationId "com.company.project"
        minSdk 21
        targetSdk 32
        versionCode 13
        versionName "2.0.34"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        externalNativeBuild {
            cmake {
                cppFlags ""
                //cppFlags "-pie -fPIE"
            }
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    testOptions {
        unitTests {
            includeAndroidResources = true
            returnDefaultValues = true
        }
    }
    packagingOptions {
        exclude 'META-INF/AL2.0'
        exclude 'META-INF/LGPL2.1'
        exclude 'META-INF/atomicfu.kotlin_module'
    }
    kotlinOptions {
        jvmTarget = '11'
    }
    dataBinding {
        enabled = true
    }
    externalNativeBuild {
        cmake {
            path "src/main/jni/CMakeLists.txt"
            version "3.10.2"
        }
    }
    ndkVersion '21.0.6113669'

    signingConfigs {
        debug {
            // Signing configs
            storeFile file("../keystore/debug.keystore")
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            // Signing configs
            storeFile file("../keystore/release.keystore")
            storePassword 'company1234'
            keyAlias 'company_key'
            keyPassword 'company1234'
            enableV2Signing = true
            enableV3Signing = true
            enableV4Signing = true
        }
    }

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            minifyEnabled false
            applicationVariants.all {
                variant - >
                    renameAPK(variant, applicationName, defaultConfig, 'D')
            }
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            applicationVariants.all {
                variant - >
                    renameAPK(variant, applicationName, defaultConfig, 'R')
            }
            ndk {
                abiFilters "armeabi-v7a", "arm64-v8a", "x86"
            }
        }
    }

    flavorDimensions "ht"
    productFlavors {
        dev {
            applicationId "com.company.project"
            buildConfigField "int", "FlavorCode", "1"
        }
        staging {
            applicationId "com.company.project"
            buildConfigField "int", "FlavorCode", "2"
        }
        prod {
            applicationId "com.company.project"
            buildConfigField "int", "FlavorCode", "3"
        }
    }
}

static def renameAPK(variant, applicationName, defaultConfig, buildType) {
    variant.outputs.each {
        output - >
            def formattedDate = new Date().format('dd-MM-yyyy_HH_mm')
        def fileName = applicationName + "_V" + defaultConfig.versionName + "_" + formattedDate + "_" + variant.flavorName + "_" + buildType + ".apk"
        output.outputFileName = new File(fileName)
    }
}

dependencies {

    /////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////
    ////////////////////////// Testing frameworks //////////////////////////
    /////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////

    //Testing frameworks
    testImplementation 'junit:junit:4.13.2'
    testImplementation 'androidx.test:core:1.4.0'
    testImplementation 'androidx.arch.core:core-testing:2.1.0'
    testImplementation 'org.mockito:mockito-core:3.5.13'
    testImplementation 'org.robolectric:robolectric:4.4'
    testImplementation 'org.robolectric:shadows-multidex:4.4'
    testImplementation "io.mockk:mockk:1.10.2"
    testImplementation 'io.mockk:mockk-common:1.10.2'
    testImplementation 'com.google.truth:truth:1.1.3'
    testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3'

    // Android Tests
    androidTestImplementation "androidx.navigation:navigation-testing:$rootProject.ext.navigation"
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test:rules:1.4.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation 'androidx.test:runner:1.4.0'
    androidTestImplementation 'androidx.arch.core:core-testing:2.1.0'
    androidTestImplementation "androidx.test:core:1.4.0"

    androidTestImplementation "androidx.fragment:fragment-testing:$rootProject.ext.fragment_version"


    /////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////
    ////////////////////////// Normal Frameworks //////////////////////////
    /////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////

    // Multidex
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.annotation:annotation:1.3.0'
    implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.ext.navigation"
    implementation "androidx.navigation:navigation-ui-ktx:$rootProject.ext.navigation"
    implementation "androidx.navigation:navigation-runtime-ktx:$rootProject.ext.navigation"
    implementation "androidx.fragment:fragment-ktx:1.2.5"


    // Kotlin & JetBrains
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.3'
    implementation 'com.github.florent37:inline-activity-result-kotlin:1.0.4'
    implementation 'org.jetbrains.anko:anko-appcompat-v7-commons:0.10.2'

    //Androidx UI Components
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation "androidx.cardview:cardview:1.0.0"

    // ViewModel LifeCycle
    implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

    //Koin
    implementation "org.koin:koin-core:$rootProject.ext.koin_version"
    implementation "org.koin:koin-android:$rootProject.ext.koin_version"
    implementation "org.koin:koin-android-viewmodel:$rootProject.ext.koin_version"
    implementation "org.koin:koin-android-architecture:$rootProject.ext.koin_architecture_version"

    //ok http
    implementation "com.squareup.okhttp3:okhttp:4.9.0"
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'

    //Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.7.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.code.gson:gson:2.8.8'

    // Room components
    implementation 'androidx.room:room-runtime:2.4.1'
    implementation 'androidx.room:room-ktx:2.4.1'
    kapt 'androidx.room:room-compiler:2.4.1'
    androidTestImplementation 'androidx.room:room-testing:2.4.1'

    // Navigation component
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'

    // Import the BoM for the Firebase platform
    implementation platform('com.google.firebase:firebase-bom:28.4.0')

    // Firebase library dependencies
    implementation 'com.google.firebase:firebase-messaging'
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-crashlytics-ktx'
    implementation 'com.google.firebase:firebase-dynamic-links-ktx'

    // sdp and ssp for dp and sp values
    implementation 'com.intuit.sdp:sdp-android:1.0.6'
    implementation 'com.intuit.ssp:ssp-android:1.0.6'

    //permissions helper
    implementation 'com.karumi:dexter:6.2.0'

    //Facebook text encryption
    implementation 'com.facebook.conceal:conceal:2.0.1@aar'

    //Lottie animations
    implementation 'com.airbnb.android:lottie:3.4.2'

    // Location services
    implementation 'com.google.android.gms:play-services-location:19.0.1'

    implementation 'com.tbuonomo:dotsindicator:4.2'

    implementation 'com.github.bumptech.glide:glide:4.11.0'
    kapt 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
    implementation 'com.github.bumptech.glide:annotations:4.11.0'

    implementation "org.ow2.asm:asm:7.0"
}

Gradle(根/应用程序)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext{
        koin_version = '2.0.1'
        koin_architecture_version = "0.8.2"
        navigation = "2.3.5"
        fragment_version = "1.4.0"
    }
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'
        classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5'
        classpath 'io.michaelrocks:paranoid-gradle-plugin:0.3.2'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

升级后,构建失败并出现以下异常

Execution failed for task ':app:transformClassesWithParanoidForDevDebug'.
> com.android.build.api.transform.TransformException: java.lang.IllegalArgumentException: Unable to read a ClassMirror for com/data/model/response/ParsingHelper$CharSequenceDeserializer

This feature requires ASM7

我尝试专门修复 ParsingHelper 类并将其代码更新为 kotlin,但随后我在不同的类中得到相同的异常。所以我相信修复整个项目中的每个java类不是一个好主意。

As per this https://stackoverflow.com/questions/68709559/nestmember-requires-asm7?noredirect=1线程更新到 AGP 版本 7.0.1 修复了问题,但我已经使用了较新的版本,即 7.0.3。


对我来说,目前唯一有帮助的是每次重建项目然后运行应用程序。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android 此功能需要 ASM7 的相关文章

随机推荐

  • 按顺序调用子项目和其他任务的 Gradle 批处理任务

    我正在为多模块项目编写 gradle 1 4 构建文件 所以有根构建 gradle定义如下 subprojects apply plugin java 它定义了build所有子模块的任务 子模块包含在设置 gradle每个模块都有其具有定义
  • 为什么使用 static_cast(x) 而不是 (T)x?

    我听说static cast函数应该优先于 C 风格或简单函数风格的转换 这是真的 为什么 主要原因是经典的 C 类型转换不区分我们所说的static cast lt gt reinterpret cast lt gt const cast
  • PHP 中没有 cookie 的 CSRF 令牌

    我正在寻找一种将 CSRF 令牌添加到我正在制作的应用程序中的方法 需要注意的是 该应用程序当前不使用 cookie 或会话 我很想找到一种引入 CSRF 令牌的方法 而不必 在我的应用程序中引入状态 使用会话或 cookie SESSIO
  • 读取 txt 文件 fscanf 与 fread 与 textscan [重复]

    这个问题在这里已经有答案了 我有一个从 SQL 2005 生成的 txt 文件 ANSI 格式 我努力了textscan and fscanf 整个txt文件只有numeric data 在线资源表明 fscanf 比 textscan 更
  • 获取外部文件目录失败

    OnActivityCreated 我正在做 activity getExternalFilesDir Environment DIRECTORY PICTURES 在 logcat 中我得到 com package W ContextIm
  • 流过滤器的时间复杂度

    我有这样的代码 List
  • 如何在delphi中使用ToastGeneric创建toast通知

    我正在使用 delphi 在桌面上进行开发 我想使用 ToastGeneric 类型通知创建 toast 通知 LToastFactory CreateToastNotification LXMLTemplate 另外 我正在使用 xml
  • 通过“with”语句使用 Python 队列

    有没有使用Python的标准方法Queue in a with陈述 这就是我希望能够使用它的方式 import Queue myqueue Queue Queue with myqueue as nextItem doStuff nextI
  • Shell 脚本 - 在文件中智能替换并在第二个文件中查找

    我有两个文件 一个数据文件和一个查找文件 数据文件的一个字段必须由一个值更改 该值可以在查找文件中找到 数据文件如下所示 2013 04 24 1 0 1635 1 4135 2013 04 24 1 0 9135 1 4135 2013
  • javascript 正则表达式计算空白字符

    我可以使用 javascript 正则表达式来计算字符串中第一个文本字符之前的空白字符数吗 我只关心是否有0 1和2 我当前的工作解决方案是拥有三个正则表达式 仅使用 match 来确定 0 1 或 2 类别 每个类别都有单独的模式 但我正
  • Oracle SQL 中是否有类似于 SUM 函数的 PRODUCT 函数?

    我有一个同事正在寻找这个 但我不记得曾经遇到过类似的事情 有没有一种合理的技术可以让你模拟它 SELECT PRODUCT X FROM SELECT 3 X FROM DUAL UNION ALL SELECT 5 X FROM DUAL
  • 单线程/核心上的并行如何可能?

    现代编程语言为用户提供了一流的并行和并发机制 我了解并行算法是如何编程的 并且可以很好地想象多核CPU上的两个线程如何并行运行 然而 大多数这些平台还支持在单个线程上运行并行进程 这些进程真的并行运行吗 在汇编级别上 两个不同的例程如何在单
  • 为什么这段代码在 jsbin 中有效,但在 jsfiddle 中无效?

    我按照此处另一位用户的建议重新发布 重新表述此内容 下面的代码适用于jsbin http jsbin com osebov 1 edit但不在jsfiddle http jsfiddle net wNaEX 有人知道为什么吗 该问题源于我尝
  • 如何从内容页访问母版页中的用户控件?

    假设我在母版页中有一个标头用户控件 并且想要根据母版页内加载的内容页来更改用户控件的属性 我该怎么办 Thanks 您可以使用两种方法 第一个是通过使用Page Master FindControl controlID 然后您可以将其转换为
  • 查找嵌套 json 对象深处的对象

    我在下面的代码片段中有嵌套的 json 对象 想要查找所有出现的 schema 并将包含该架构值的整个对象保存到另一个对象中 我尝试使用 lodash 过滤器 但没有成功 有没有人有什么建议 element parseResult cont
  • 预授权不起作用

    我正在编写一个套接字服务器 无 Web 应用程序 应用程序 并希望使用基于方法的安全性来处理我的 ACL 需求 我按照我发现的一个小教程进行操作春季安全举例 http blog solidcraft eu 2011 03 spring se
  • 为什么我不能使用“scanf_s”同时读取字符和数字?

    这段代码崩溃了 scanf s c d ch x Run error 但这段代码有效 scanf s c ch scanf s d x Run succeed 我想知道为什么第一个代码片段是错误的 运行错误 的意思是 当我运行程序输入时 编
  • 返回 false 不停止表单提交

    我很确定这应该不会那么难 我有一个在提交时运行以下函数的表单 function FORMVALIDATE add rota entry var rota date rota date val var rota id rota id val
  • 自定义 Slack 机器人无法连接

    我一直在尝试制作一个 Slack 机器人 它可以回复简单的查询并做一些简单的事情来帮助办公室工作 该机器人工作正常 只是似乎无法从我们的代理后面连接到 Slack 当我从自己的移动互联网连接测试它时 它工作正常 但是当尝试在代理后面运行它时
  • Android 此功能需要 ASM7

    可能重复 https stackoverflow com questions 68709559 nestmember requires asm7 noredirect 1 我已将 Android Studio 更新为 Android Stu