在android.support.v7.appcompat.R.java下使用搜索模板复制的资源id
生成我的应用程序时,我遇到以下错误:在android.support.v7.appcompat.R.java下使用搜索模板复制的资源id,android,Android,生成我的应用程序时,我遇到以下错误: 01-31 13:28:58.594 E/AndroidRuntime(10369): FATAL EXCEPTION: main 01-31 13:28:58.594 E/AndroidRuntime(10369): Process: com.example.app, PID: 10369 01-31 13:28:58.594 E/AndroidRuntime(10369): java.lang.NoSuchFieldError: No static fi
01-31 13:28:58.594 E/AndroidRuntime(10369): FATAL EXCEPTION: main
01-31 13:28:58.594 E/AndroidRuntime(10369): Process: com.example.app, PID: 10369
01-31 13:28:58.594 E/AndroidRuntime(10369): java.lang.NoSuchFieldError: No static field framelayout_content of type I in class Lcom/sdk/sample/R$id; or its superclasses (declaration of 'com.sdk.sample.R$id' appears in /data/app/com.example.app
当我搜索“framelayout\u content”的resourceId时
在android.support.v7.appcompat.R.java文件中:
public static final int search_plate = 0x7f0f0057;
在我的模块R文件(com.sdk.sample.R.java)中:
ID是重复的!
在最后的R文件(com.example.app.R.java)中,它只有:
public static final int search_plate=0x7f0f0057;
framelayout\u内容
已丢失,导致错误
有人能帮忙吗
附言:
我试图重命名framelayout\u内容
但没有帮助
以下是我的项目结构:
在settings.gradle中:
include ':app', ':Module'
在应用程序下:
dependencies {
compile project(': Module')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
testCompile 'com.android.support.test:runner:1.0.1'
testCompile 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.android.support:multidex:1.0.1'
}
在模块下:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup:otto:1.3.8'
}
01-31 13:28:58.594 E/AndroidRuntime(10369):
java.lang.NoSuchFieldError:无静态字段
仅当类的定义发生不兼容的更改时,才能在运行时发生。因此,在project中查找重复的XML。只需重新命名其中一个。然后清理重建并运行
FYI
public static final int search_plate = 0x7f0f0057;
Android R.java是由aapt(Android资产)自动生成的文件
打包工具),其中包含的所有资源的资源ID
res/目录
通过重命名其中一个布局文件来解决,这是因为包含
framelayout\u内容的布局文件与模块中的布局文件同名。谢谢@IntelliJ Amiya请清理重建。@IntelliJAmiya我尝试过很多次:(@IntelliJAmiya谢谢!我有两个同名的布局文件!
public static final int search_plate = 0x7f0f0057;