java - Android studio 用 gradle 编译 Android project 怎么样配置来保持行号
ringa_lee
ringa_lee 2017-04-17 13:02:15
[Java讨论组]

为了混淆后还能看到crash时报错的行号,需要配置javac参数来保持行号

以前用 ant 是这样

<javac
debug="true" debuglevel="source,lines,vars" get/classes"  
 </javac>

现在Android studio 改用 gradle , 我在网上查找了一些方法
1)方法1:地址:https://github.com/codeborne/selenide/blob/master/build.gradle

 allprojects {
repositories {
    jcenter()
}

compileJava.options.debugOptions.debugLevel = "source,lines,vars"
}

但编译报错:
Error:(16, 0) Could not find property 'compileJava' on root project

加上 apply plugin: 'java'

allprojects {
    repositories {
        jcenter()
    }
    apply plugin: 'java'
    compileJava.options.debugOptions.debugLevel = "source,lines,vars"
    }

报错:Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.

2)方法2 地址:http://gradle.1045684.n5.nabble.com/Providing-custom-debugLevel-for-compile-task-td1433678.html

allprojects 
{ 
     usePlugin('java') 

     // define global compile options 
     compile.destinationDir = new File("$rootDir/tmp/build/classes") 
     compile.sourceCompatibility = 1.4 
     compile.targetCompatibility = 1.4 
     compile.options.bootClasspath = bootClasspath 
     compile.options.debug = true 
     compile.options.debugOptions.debugLevel = 'lines,source' 
     compile.options.deprecation = true 
} 

也是但编译报错:
Error:(16, 0) Could not find property 'compile' on root project

我的gradle 配置
classpath 'com.android.tools.build:gradle:1.0.0'
distributionUrl=https://services.gradle.org/distributions/gradle-2.2.1-all.zip

求大牛解答,先谢谢

ringa_lee
ringa_lee

ringa_lee

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号