[英]Cannot resolve symbol 'R' in a module
I'm finally migrating from Eclipse to Android Studio and can't even connect a little module. 我终于从Eclipse迁移到Android Studio,甚至无法连接一个小模块。
Here's the only file in resources - as you can see by a screenshot, there is no error there 这是资源中唯一的文件-如屏幕截图所示,那里没有错误
But in the class where it is needed 'R' is not resolved. 但是在需要的类中,“ R”无法解析。 So I'm confused - there is not too much to look into 所以我很困惑-没有太多的研究
There are problems in App's module as I didn't hook all the libraries yet, but no obvious problem in 'dragsortlib' module. App的模块存在问题,因为我还没有钩住所有库,但是'dragsortlib'模块中没有明显的问题。 I cleaned, rebuilt project but this didn't help. 我清理并重建了项目,但这没有帮助。
manifest : 清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mobeta.android.dslv"
android:versionCode="4"
android:versionName="0.6.1">
<uses-sdk android:targetSdkVersion="7"
android:minSdkVersion="7" />
</manifest>
gradle : gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "24.0.2"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile files('libs/android-support-v4.jar')
testCompile 'junit:junit:4.12'
}
I would like to make clear that this Error occurs while there is any issue in your res folder and it is not allowing to auto generate resource id in R.Java file. 我想明确指出,此错误是在res文件夹中存在任何问题时发生的,并且不允许在R.Java文件中自动生成资源ID。 So look it carefully in your resource folder and manifest what causes this error. 因此,请在您的资源文件夹中仔细查看它,并找出导致此错误的原因。
It would be a little mistake causing this error, Once you find that mistake you can easily resolve this error, But most of the case you need to Clean Project or Invalidate Cache and Restart will work after resolving issue. 这将是导致该错误的一个小错误,找到该错误后,您可以轻松解决此错误,但是在大多数情况下,您需要清理项目或使缓存无效并重新启动即可解决问题。
Hope this will work. 希望这会起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.