问题描述
对不起,我的英语不好。我正尝试通过Android Studio将我的项目迁移到Gradle,但目前构建在 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:
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!