deptofdefense / AndroidTacticalAssaultKit-CIV

Other
918 stars 329 forks source link

Unable to install release version of plugins into release version of TAK #56

Open talentedbrute opened 3 years ago

talentedbrute commented 3 years ago

Have successfully built and deployed a 4.2 release version of TAK onto a Samsung Tab A. Unable to install a release version of the HelloWorld plugin. Using a debug version of TAK and a debug version of the plugin works. The same signing keys are used for TAK and the plugins.

image

Attempting the same thing with our home gown plugin. Release version fails to install but debug version works. image

takdeveloper commented 3 years ago

The obfuscation mapping that is generated when ATAK is built in release mode must be fed as an input into the plugin's build so that the plugin properly refers to the obfuscated API.

For local builds, this will require placing the mapping file in a specific location relative to your plugin project. Please see https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak-gradle-takdev/src/main/groovy/com/atakmap/gradle/takdev/TakDevPlugin.groovy#L123 to get insight into the locations where the mapping file is being searched for.

talentedbrute commented 3 years ago

Thanks for the insight. I moved my plugin code into the ATAK source folders so the paths line up but I still get the same error above. I have rebuilt and reinstalled ATAK and the plugin.

takdeveloper commented 3 years ago

@tareed I would suggest building the atak-gradle-takdev plugin locally and adding some debugging statements to determine if the mapping file is properly being discovered. Assuming everything is good, the proguard mapping from the ATAK release build should get copied to <plugin-root>/app/build/proguard-<variant>-release-mapping.txt. It should be ~8MB in size. The path to this file gets set on the system property, atak.proguard.mapping, which should be getting applied via the plugin's proguard configuration (see https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/plugin-examples/plugintemplate/app/proguard-gradle.txt#L10).

Unfortunately, without seeing the project or how the development environment is configured, I can't provide much guidance outside of suggesting that it sounds like the proguard mapping from the ATAK release build is not properly being consumed by the plugin release build.

talentedbrute commented 3 years ago

While I look at your other suggestions here is how the dev environment is configured. I am building this on Ubuntu 18.04, I have the latest 4.2.0 baseline pulled and I have moved my plugins folder inside of the root atak source folder (see screenshot). This way the paths lines up with what you suggested.

Screen Shot 2021-04-08 at 3 03 44 PM
talentedbrute commented 3 years ago

Solved it. Here is what I had to do to solve this.

  1. The plugin is two folders deep in the atak source folder (i.e. plugins/wxdata)
  2. Build atak and assembleCivRelease this gets you main.jar and the right mapping.txt
  3. In the root of the atak source folder make sure the keystore is called android_keystore

The missing piece for me was the keystore, once I created a softlink to my real keystore it worked just fine. The atak-gradle-taskdev plugin is checking the location of main.jar, mapping.txt and android_keystore to determine what type of build this is going to be (online or offline). To do what I needed I needed it to be an online build.

takdeveloper commented 3 years ago

@tareed We'll look to resolve this in the atak-gradle-takdev plugin in one of the upcoming releases.