Open Source Parse Module


#1

Hi there,

I’m about to update the Parse Module with the most recent version of the Parse SDK, which supports self-hosted ParseServers.

While iOS is working fine, the Android version fails to compile:
error: duplicate class: io.trigger.forge.android.modules.parse.R

There are two files with the same name and package in the classpath. One is generated by Android the other by the Trigger Toolkit.

The 2nd one seems to be used to support custom push icons.

As a workaround, I deleted the 2nd one, so the compilation succeeds. But I still can’t test my modified module in our app because the forge build android step fails:
AAPT: Resource id cannot be an empty string (at 'resource' with value '@drawable/')

This is caused by the “empty” resource declaration for the com.parse.push.notification_icon in the AndroidManifest.xml of the ForgeInspector (which is also generated by the Trigger Toolkit).

You can find my current progress here.


#2

Resource handling with AndroidStudio/Gradle can sometimes be a bit of a pain at the moment because we’re still trying to hold on to some backwards compatibility with Eclipse for folk who haven’t made the switch yet.

Deleting ./inspector/an-inspector/ForgeModule/src/io/trigger/forge/android/modules/parse/R.java worked because Gradle does its own resource generation now.

I think the reason you’re seeing the resource ID error is due to a bug with platform version 2.4.4 that was picking up the Eclipse version of the module rather than the Android Studio version. Switching to v2.4.5 sorted this out.

I also picked up another issue when trying to call methods on the module, it looks like the new SDK is using reflection for method lookups so I had to add a couple of ProGuard rules to stop them from being stripped in the production build.

Finally, we can specify .aar repository dependencies directly in the module build steps file now so I’ve removed the Parse .jar files.

To summarise:

  • I bumped platform version in module/manifest.json to v2.4.5

  • Added ProGuard rules for com.parse.** to module/android/build_steps.json

  • Removed the Parse jar files and added com.parse:parse-android:1.13.1 to module/android/build_steps.json

  • Updated the Android inspector

  • Cleaned out extraneous resource files:

      rm ./inspector/an-inspector/ForgeModule/src/io/trigger/forge/android/modules/parse/R.java
      rm -rf ./inspector/an-inspector/ForgeInspector/res_module_parse
    
  • Updated the module: cd ./inspector/an-inspector && gradle updateModule

I’ve sent you a pull request for the changes: https://github.com/scthi/trigger.io-parse/pull/1


#3

Thanks @antoinevg for your fast response. I merged your PR and tried again. Unfortunately, the error during forge build android is still there:

ForgeInspector:processVanillaReleaseManifest
:ForgeInspector:processVanillaReleaseResources/tmp/tmphlp8x5/android/ForgeInspector/build/intermediates/manifests/full/vanilla/release/AndroidManifest.xml:62:31-41: AAPT: Resource id cannot be an empty string (at 'resource' with value '@drawable/').
    
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ForgeInspector:processVanillaReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/mnt/android-sdks/24.0.2/build-tools/23.0.2/aapt'' finished with non-zero exit value 1

The error occurs, because the custom icons are not replaced correctly during the build. The build seems to work with the “module name” not the “module namespace”, which means that I can workaround this by replacing parse with the name of our module within the module/android/build_steps.json file…

UPDATE

I opened a PR: https://github.com/trigger-corp/trigger.io-parse/pull/6 since this should work out of the box if the module name is parse.


#4

:blush: Can’t believe I missed that :blush:

As a workaround for custom forks you’ll need to edit module/android/build_steps.json and replace references to:

{{modules.parse.config.android ... }}

with {{modules.<your-module-name>.config.android ... }}

Thank you muchly for the PR @scthi, great work!

I’ve updated the official Parse module with your changes and published it to v2.13.


#5

Going through the process of migrating to our own Parse Server, we’ve identified another roadblock that doesn’t seem well documented in the Parse migration guide: On Android, you’re supposed to use your own GCM sender ID, as the Parse default ID will be invalidated in January 2017. I’ve filed another PR with a new option to set your own GCM sender ID(s) within the official Trigger.io Parse module :slight_smile:


#6

Nice, thank you @prud! :slight_smile:

I’ve just pushed v2.14 of the Parse module which integrates your pull request with the following changes:

  • Removed Android permission GET_ACCOUNTS as it is no longer required.
  • Resolved iOS linker conflicts with the Facebook module caused by both including the Bolts framework.

To resolve the conflicts with the Bolts framework I had to remove it from Parse and created a new dependent module: bolts that is included by the Facebook and Parse modules as a dependency.

Note that the new version requires Forge platform version: v2.4.6


#7

Regarding your last remark: I’ve just realized that we’ve been testing Parse module v2.14 with Bolts v1.6.0 and Platform v2.4.5 for a week now without any issues (no Facebook module in use anymore).

Any chance you know why we don’t see any errors despite not using v2.4.6 platform?


#8

On Android the Bolts package gets pulled in by Gradle via the declaration in the Parse SDK .aar so it still gets the dependency even if the “bolts” module dependency wasn’t pulled in.

iOS does need to be on v2.4.6 to pick up Bolts.