Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

出现还是出现问题,无法生成R.txt #32

Closed
zasdsd opened this issue Apr 15, 2017 · 12 comments
Closed

出现还是出现问题,无法生成R.txt #32

zasdsd opened this issue Apr 15, 2017 · 12 comments

Comments

@zasdsd
Copy link

zasdsd commented Apr 15, 2017

我现在出现的问题是无法编译,我试了几天,发现问题出现在R.txt没有出现,但是我找不到方法调试,不清楚是图片还是layout文件出了问题。
目前根据您的提示修改成了
classpath 'com.dx168.fastdex:gradle-plugin:0.1.0-beta'//之前使用的release

目前我的想法是估计R.txt无法生成出来 , 我进入到目录了也是发现 没有 /r/R.txt 这个文件。
日志如下:
====================fastdex====================
==fastdex android.buildTypes.release.minifyEnabled=true, just ignore
====================fastdex====================
:taojinroad:fastdexProcessTaojinroadDebugResourceId
==fastdex apply resource mapping file /Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/fastdex/TaojinroadDebug/r/R.txt is illegal, just ignore

BUILD SUCCESSFUL
之前一直编译不了我估计也是卡在这个地方,但是我不使用fastdex 就可以编译
目前我使用./gradlew fastdexProcessTaojinroadDebugResourceid --stacktrace定位出来的。
请问有没什么办法进行调试,这个任务为什么r文件不存在

@zasdsd
Copy link
Author

zasdsd commented Apr 15, 2017

是不是我的gradle 里还需要配置什么吗,我的项目bundle.gradle里已经使用apply plugin: 'com.dx168.fastdex' ,难道还需要什么其他的东西,但是网上的文档里没要求,demo里也没要求

@typ0520
Copy link
Owner

typ0520 commented Apr 15, 2017

每次打包成功后会在FastdexTransform中把生成的r文件复制到缓存中

void copyRTxt() {
    File sourceFile = new File(fastdexVariant.androidVariant.getVariantData().getScope().getSymbolLocation(),"R.txt")
    FileUtils.copyFileUsingStream(sourceFile,FastdexUtils.getResourceMappingFile(fastdexVariant.project,fastdexVariant.variantName))

你检查下是不是没有复制成功

@typ0520
Copy link
Owner

typ0520 commented Apr 17, 2017

@zasdsd 第一次全量编译�过程中报/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/fastdex/TaojinroadDebug/r/R.txt is illegal, just ignore是正常的,全量打包成功以后到这个目录下看下如果还没有就不正常,这个文件的来源是了,/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/intermediates/symbols/debug/R.txt,再确认下这个文件是否存在

@zasdsd
Copy link
Author

zasdsd commented Apr 17, 2017

确实没有这个目录symbols/debug/R.txt,我的目录是/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/intermediates/symbols/taojinroad/debug/R.txt.和你说的目录有差异
之前有一段时间是可以的,最近一周才出现这个问题,难道是因为我的项目导入了其他模块造成的?

@zasdsd
Copy link
Author

zasdsd commented Apr 17, 2017

@typ0520 我现在就在纠结这个目录,有没办法使用源码调试的。

@zasdsd
Copy link
Author

zasdsd commented Apr 17, 2017

我先搜索下看这里的源码怎么使用, 不太懂,谷歌下先

@typ0520
Copy link
Owner

typ0520 commented Apr 17, 2017

@zasdsd 你把这段代码放进你的application工程的build.gradle中,随便执行一个任务,看下输出的r文件路径对不对,如果这种方式获取的正确我就改下代码

project.afterEvaluate {
    android.applicationVariants.all { variant ->
        println("==r.txt dir: ${project.buildDir}/intermediates/symbols/${variant.dirName}/R.txt")
    }
}

另外在看下这两个目录是否存在
/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/generated/source/r/debug
/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/generated/source/buildConfig/debug

@zasdsd
Copy link
Author

zasdsd commented Apr 17, 2017

@typ0520 日志结果:
==r.txt dir: /Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/intermediates/symbols/taojinroad/debug/R.txt

另外你叫我看的2个目录
/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/generated/source/r/taojinroad/debug
/Users/zhengmj/Desktop/TjrTaojinRoad/taojinroad/build/generated/source/buildConfig/taojinraod/debug

@zasdsd
Copy link
Author

zasdsd commented Apr 17, 2017

顺便说下,我的gradle 使用的是 classpath 'com.android.tools.build:gradle:2.2.0'

@typ0520
Copy link
Owner

typ0520 commented Apr 17, 2017

@zasdsd 我知道是什么原因了,你暂时先关掉fastdex,解决好了以后会发新版本到时候给你说一声

@typ0520
Copy link
Owner

typ0520 commented Apr 17, 2017

@zasdsd 帮在执行以下代码,确认之前用的api

project.afterEvaluate {
    android.applicationVariants.all { variant ->
        File rtxtFile = new File(variant.getVariantData().getScope().getSymbolLocation(),"R.txt")

        println("==rtxtFile: ${rtxtFile}")
    }
}

你直接加下我qq吧752554930,还有关于library工程的路径找你确认一下,你的工程输出的路径和别人的都不一样啊

@typ0520
Copy link
Owner

typ0520 commented Apr 17, 2017

已解决

@typ0520 typ0520 closed this as completed Apr 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants