gpt4 book ai didi

android - 更新到Android 3.1.3时找不到符号R

转载 作者:行者123 更新时间:2023-12-03 04:59:05 29 4
gpt4 key购买 nike

昨天我将Android更新为Android 3.1.3,直到今天创建一个新的Empty Activity并在“AppCompatActivity”上向我显示错误“找不到符号”后,一切都还不错,所以我进行了搜索并阅读了其中的内容与“build.gradle”有关,所以我一直在更新库并遇到不同的错误,最新的错误是对象“R”无法解析符号。所以这就是我所拥有的。

我已经做了很多尝试来解决它(您可以在代码中看到注释),但是到目前为止,我还没有解决它。请帮我!

同样在一个部分中,Android建议我将gradle.properties#org.gradle.parallel = true从false更改为false,而且也没有用。

build.gradle

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
//classpath 'com.android.tools.build:gradle:2.1.3'
//classpath 'com.android.tools.build:gradle:3.2.0-alpha17'
//classpath 'com.android.tools.build:gradle:3.1.3'
//classpath 'com.google.gms:google-services:3.2.0'
//classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
//name 'Google'
}
}
}

依赖
android {
compileSdkVersion 23
buildToolsVersion '24.0.2'

defaultConfig {
applicationId "com.example.dell.getspeed"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'net.gotev:uploadservice:2.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'

/*implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'


/*implementation 'com.android.support.constraint:constraint-layout:1.1.2'
//implementation 'com.android.support:appcompat-v7:27.1.0'
//implementation 'com.android.support:design:26.4.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.github.anastr:speedviewlib:1.2.0'
compile 'com.android.support:design:25.4.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
//compile 'com.android.support.constraint:constraint-layout:1.1.2'*/
}

gralde-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

日志:
Logs

最佳答案

关闭项目,然后再次导入。今天为我工作。



由于某些原因,在26个库中找不到这些属性。为了增加这些库,您还必须将compileSdk增加到27。可能您还必须下载sdk 27

简短版,紧随其后的是应用程序gradle

compile更改为implementation

    apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "cl.cutiko.testingupdate"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

build.gradle(项目)
buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'


// 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
}

关于android - 更新到Android 3.1.3时找不到符号R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51299171/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com