android - 无法解析模块中的符号 'R'

标签 android android-studio android-resources

我终于要从 Eclipse 迁移到 Android Studio,但连一个小模块都无法连接。

这是资源中唯一的文件 - 正如您通过屏幕截图所见,那里没有错误

enter image description here

但是在需要它的类中,'R'没有被解析。所以我很困惑——没有太多需要研究的地方

enter image description here

App 的模块有问题,因为我还没有 hook 所有的库,但 'dragsortlib' 模块没有明显的问题。 我清理并重建了项目,但这没有帮助。

list :

<?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>

渐变:

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

最佳答案

点击 Build -> Rebuild Project 然后点击 Tools -> Android -> Sync Project with Gradle Files。

您可以引用here

关于android - 无法解析模块中的符号 'R',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40544291/

相关文章:

android - URI 未注册 Android studio 错误

java - android以编程方式替换可绘制图像

android - 如何从SQLite表中读取一行的多条记录?

Android 从类开始 Activity

android - Clear( ) ArrayAdapter 无法正常工作 - Android

android - 原因:无效的区 block 类型[Android]

android-studio - 模拟器显示旧的红色电话

长按Android自定义键盘弹出键盘

java - 使用 TextView.setText 显示数据时出错 : Resources$NotFoundException: String resource ID #0x0

android - 高密度手机默认到哪个drawable文件夹?