I created this hello world app like so:
-
Per the instructions here: https://capacitor.ionicframework.com/docs/getting-started/with-ionic/
I created the app using the below commands:
ionic start myApp tabs --capacitor
(I chose the angular option for 'framework')
ionic build
npx cap add android
-
Created a git repo for the project
-
Per the instructions here: https://ionicframework.com/blog/introducing-capacitor-support-for-ionic-appflow/
I add the AppFlow feature using the below commands:
ionic link
(First prompt: Create new app or link existing one? I chose "create a new app")
(Second prompt: provide a name for new app)
(Third prompt: Link to github and selected the repository that I created in step 2, and linked to master branch)
ionic deploy add
(First prompt: Appflow App ID? I just clicked enter to use the created app in the previous command)
(Second prompt: Channel Name? "Master")
(Third Prompt: Update Method? "background") -
I committed the code to the repo
-
I set gradlew permissions for build:
cd android
git update-index --chmod=+x gradlew
-
Update version of gradle being used in build.gradle (root)
classpath 'com.android.tools.build:gradle:3.6.3'
(vs 3.6.1)
A note that I chose to update this because when I built locally in android studio, it wanted to update the gradle version. I attempted an appflow build using 3.6.1 and 3.6.3 and both ended up with the error at the bottom. -
Committed code
-
Logged into ionic appflow dashboard (https://dashboard.ionicframework.com/) and built the latest commit for android / debug
-
Downloaded apk and installed on device to verify it does not crash
-
I navigated to the project root and installed cordova-background-geolocation-lt per here: https://github.com/transistorsoft/cordova-background-geolocation-lt/blob/master/help/INSTALL_CAPACITOR.md
I used the below commands
npm install cordova-background-geolocation-lt
npx cap sync
-
I added the following lines to app/build.gradle
apply plugin: 'com.android.application'
+def background_geolocation = "../../node_modules/cordova-background-geolocation-lt/src/android"
+apply from: "$background_geolocation/app.gradle"
android {
.
.
.
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ proguardFiles "$background_geolocation/proguard-rules.pro"
}
}
}
-
Commit to AppFlow
-
Log into ionic dashboard and built latest commit for android in debug mode
-
Build fails with:
- What went wrong: A problem occurred evaluating project ':capacitor-cordova-android-plugins'. Could not get unknown property 'applicationVariants' for object of type com.android.build.gradle.LibraryExtension.
- Not sure if this helps, but somehow the plugin is thinking it's a release build or not recognizing capacitor correctly: