【问题标题】:Why does my code show an error for a file that is not present in my android studio?为什么我的代码对我的 android studio 中不存在的文件显示错误?
【发布时间】:2020-05-23 03:40:29
【问题描述】:

我在 android studio 中遇到问题。 我导入了这个项目并尝试使用 logcat 和木材日志,但它在构建中显示错误,而且在 logcat 中我看不到我的项目,没有显示可调试的过程。

这是 build.gradle 文件

buildscript {
    ext.kotlin_version = '1.3.30'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

这个 gradle 应用代码

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.android.dessertpusher"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4'
    implementation 'com.jakewharton.timber:timber:4.7.1'
}

这是错误,我的资源选项卡中没有 values.xml 资源

.gradle\caches\transforms-2\files-2.1\d8475bbb2e3cd4785bafd0a23122f74a\constraintlayout-2.0.0-alpha4\res\values\values.xml:209:5-3555: AAPT: error: resource attr/motionProgress (aka com.example.android.dessertpusher:attr/motionProgress) not found.

【问题讨论】:

    标签: android android-studio kotlin gradle build.gradle


    【解决方案1】:

    您在constraintlayout:2.0.0-alpha4 中似乎遇到了以下问题:https://issuetracker.google.com/issues/136103084

    问题似乎在2.0.0-beta3 中得到解决,因此希望使用更新的版本可以解决您的问题。根据Google's Maven Repositoryconstraintlayout的最新版本是2.0.0-beta6

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-04
      • 1970-01-01
      • 2020-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-30
      • 2022-01-06
      相关资源
      最近更新 更多