Search code examples
androidapkdiawi

Upload generated .apk into Diawi using script


Is it possible to avoid manually uploading the .apk file into Diawi by using some scripts? I saw that there is a plugin for Jenkins that uploads the .apk after CI and I was wondering if it is possible to do the same locally by using the command line.


Solution

  • After browsing in the Diawi documentation I found some guidance here. But I had issues with the HTTP 2 version and I had to force curl to use HTTP 1.1 instead. You can open the terminal of the Android Studio a just write the scripts. With the gradlew assembleRelease a .apk file will be generated, and after that, the curl command will upload it to your Diawi profile.

    This is the command for Mac users:

    ./gradlew assembleRelease && curl -v --http1.1  https://upload.diawi.com/ -F token='<your_DIAWI_token>' -F file=@/<path_to_your_apk>/myapp-release.apk -F find_by_udid=0 -F callback_emails='<your_mail>'
    

    This is for Windows users:

    gradlew assembleRelease && curl -v --http1.1  https://upload.diawi.com/ -F token="<your_DIAWI_token>" -F file=@/<path_to_your_apk>/myapp-release.apk -F find_by_udid=0 -F callback_emails="<your_mail>"