Android项目的Gradle组装失败,无法找到R.txt [英] Gradle assemble of an Android project failed, can't find R.txt

查看:625
本文介绍了Android项目的Gradle组装失败,无法找到R.txt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我的英语不好。我正尝试通过Android Studio将我的项目迁移到Gradle,但目前构建在 processDebugResources 中失败。

错误信息:


任务':app:processAdultDebugResources'的执行失败。 (b系统找不到指定的文件)。中文的意思是系统无法找到文件)

另外,我发现在 build code>我的项目路径有一个奇怪的路径下的 R.java 文件: build / source / r / debug / - 输出文本符号



这是我的 build.gradle 的一部分, :

 应用插件:'android'
android {
compileSdkVersion 19
buildToolsVersion '19 .0 .1'

defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 78
versionName1.7.72
ndk {
abiFiltersarmeabi
}
}
productFlavors {
weightloss {
packageNamecom.yesudoo.yymweightloss
}
成人{
packageNamecom.yesudoo.yymadult
}
}
buildTypes {
debug {
packageNameSuffix.dev
versionNameSuffix-dev
}
}
lintOptions {
abortOnError false
}
}


我是Gradle的新成员,并且预先感谢有关如何解决此问题的任何指示。
<我解决这个问题的方式是:我的 androidTest 文件夹内的

文件夹 ,我有一个 java 文件夹和我的测试文件。但是Gradle需要你在测试内部有一些资源,以便它生成 R.txt 文件。因此,我在 androidTest 内创建了一个 res 文件夹,并在一个字符串资源中添加了 values / strings.xml 文件夹。



这允许我的测试生成并运行!


Sorry for my poor English. I'm trying to migrate my project to Gradle with Android Studio, but currently the build fails during processDebugResources.

error info:

Execution failed for task ':app:processAdultDebugResources'. java.io.FileNotFoundException: C:\Projects\YYM\app\build\symbols\adult\debug\R.txt (系统找不到指定的文件。)(That Chinese means "System cannot find the file")

In addition, I found that in the build path of my project there was a R.java file under a strange path: build/source/r/debug/--output-text-symbols.

Here is a part of my build.gradle:

apply plugin: 'android'
android {
    compileSdkVersion 19
    buildToolsVersion '19.0.1'

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 19
        versionCode 78
        versionName "1.7.72"
        ndk {
            abiFilters "armeabi"
        }
    }
    productFlavors {
        weightloss {
            packageName "com.yesudoo.yymweightloss"
        }
        adult {
            packageName "com.yesudoo.yymadult"
        }
    }
    buildTypes {
        debug {
            packageNameSuffix ".dev"
            versionNameSuffix "-dev"
        }
    }
    lintOptions {
        abortOnError false
    }
}

I'm new in Gradle, and thanks in advance for any pointers on how to solve this problem.

解决方案

So the way I fixed this was:

inside my androidTest folder, I had a java folder with my test files. But gradle requires you to have some resources inside test so that it generates the R.txt file. So what I did was created a res folder inside androidTest and added a values/strings.xml folder with one string resource.

This allowed my tests to build and run!

这篇关于Android项目的Gradle组装失败,无法找到R.txt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆