I use bugsnag to monitor crashes in my Android app. I also use ProGuard when I compile a release version. I need to upload the mapping.txt file that is generated in build/outputs/mapping/prod/release folder of my project.
When I run this command in (Windows) command line:
curl https://upload.bugsnag.com -F proguard=@C:/mapping.txt -F apiKey=1111111111111111111111 -F versionCode=11111111 -F appId=com.my.package -F versionNumber=1.0.0
The file is uploaded and everything works.
All I need is to add a task to gradle so it uploads the file once its ready. So once I compile the project for release, the mapping.txt file gets generated and once its ready, upload the file using this curl command (which is taken from bugsnag's web site by the way).
I tried many variations. The current one compiles but I do not think the file is being uploaded... I can't see any indication that it actually happened. This is the code I currently use:
task uploadPro(type: Exec) {
logger.error("inside upload task")
commandLine 'cmd', '/c', 'curl', 'https://upload.bugsnag.com', '-F','proguard=@build/outputs/mapping/prod/release/mapping.txt', '-F', 'apiKey=1111111111111111111111', '-F', 'versionCode=111111', '-F', 'appId=com.my.package', '-F', 'versionNumber=1.0.0'
standardOutput = new ByteArrayOutputStream()
doLast {
String output = standardOutput.toString()
logger.info(output);
}
}
I also tried using this:
def p = ['cmd', '/c', 'curl', 'https://upload.bugsnag.com', '-F', 'proguard=@build/outputs/mapping/prod/release/mapping.txt', '-F', 'apiKey=11111111111111111111111', '-F', 'versionCode=1111111', '-F', 'appId=com.my.package', '-F', 'versionNumber=1.0.0'].execute()
The way I call this task is by using this command:
tasks.getByName("assembleRelease").finalizedBy(uploadPro)
Im really not sure how to do this. Any help is appreciated!! Thank you!