transistorsoft / capacitor-background-geolocation

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
MIT License
96 stars 16 forks source link

Capacitor 6 Version? #246

Closed Dante1349 closed 5 months ago

Dante1349 commented 6 months ago

Context

I'm trying to update to capacitor 6 which is working only with --legacy-peer-deps since this plugin still has capacitor 5.0.0 as peer dependency. Capacitor updated its release cycle so i think either this peer dependency should be removed or the release cycle of this plugin should change either. So my only question is when do you release the Capacitor 6 version of this plugin?

christocracy commented 6 months ago

I wasn’t aware of this. I’ll investigate.

Dante1349 commented 6 months ago

@christocracy thank you very much! Here is a reference to the changes: https://ionic.io/blog/introducing-a-new-capacitor-release-cadence

christocracy commented 6 months ago

Way to go Ionic: "Updating to Capacitor 6"

Screenshot 2024-04-16 at 10 44 38 AM
Dante1349 commented 6 months ago

@christocracy it was just released yesterday, they moved the documentation. There was a long beta phase before, but i think this is what you are looking for: https://capacitorjs.com/docs/updating/6-0

christocracy commented 5 months ago

released:

chriswatt commented 5 months ago

@christocracy Thanks for updating the plugin so quickly to work with Capacitor 6. When building a new app using using Ionic 8 and Capacitor 6.0.0, I installed both

@transistorsoft/capacitor-background-geolocation@6.0.0
@transistorsoft/capacitor-background-fetch@6.0.0

When trying to run the app it gives the the following error.

ionic capacitor run android -l --external

> capacitor.cmd run android --no-sync --target 39251FDJH00H4T
[capacitor] × Running Gradle build - failed!
[capacitor] [error] 
[capacitor]         > Configure project :app
[capacitor]         WARNING: Using flatDir should be avoided because it doesn't support any meta-data formats.
[capacitor]
[capacitor]         > Configure project :capacitor-cordova-android-plugins
[capacitor]         WARNING: Using flatDir should be avoided because it doesn't support any meta-data formats.
[capacitor]
[capacitor]         > Task :app:preBuild UP-TO-DATE
[capacitor]         > Task :app:preDebugBuild UP-TO-DATE
[capacitor]         > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[capacitor]         > Task :app:javaPreCompileDebug UP-TO-DATE
[capacitor]         > Task :capacitor-android:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-android:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-app:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-app:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-app:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-community-sqlite:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-community-sqlite:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-community-sqlite:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-google-maps:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-google-maps:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-google-maps:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-cordova-android-plugins:writeDebugAarMetadata
[capacitor]         > Task :capacitor-haptics:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-haptics:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-keyboard:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:preBuild UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:preDebugBuild UP-TO-DATE
[capacitor]         > Task :capacitor-status-bar:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :transistorsoft-capacitor-background-geolocation:preBuild UP-TO-DATE
[capacitor]         > Task :transistorsoft-capacitor-background-geolocation:preDebugBuild UP-TO-DATE
[capacitor]         > Task :transistorsoft-capacitor-background-geolocation:writeDebugAarMetadata UP-TO-DATE
[capacitor]         > Task :app:checkDebugAarMetadata FAILED
[capacitor]
[capacitor]         FAILURE: Build failed with an exception.
[capacitor]
[capacitor]         * What went wrong:
[capacitor]         Execution failed for task ':app:checkDebugAarMetadata'.
[capacitor]         > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
[capacitor]         > Could not find any matches for com.transistorsoft:tslocationmanager:+ as no versions of com.transistorsoft:tslocationmanager are available.
[capacitor]         Searched in the following locations:
[capacitor]         - https://dl.google.com/dl/android/maven2/com/transistorsoft/tslocationmanager/maven-metadata.xml
[capacitor]         - https://repo.maven.apache.org/maven2/com/transistorsoft/tslocationmanager/maven-metadata.xml
[capacitor]         - file:/C:/Users/Ultra/repos/tricorder/android/capacitor-cordova-android-plugins/src/main/libs/
[capacitor]         - file:/C:/Users/Ultra/repos/tricorder/android/app/libs/
[capacitor]         - https://developer.huawei.com/repo/com/transistorsoft/tslocationmanager/maven-metadata.xml
[capacitor]         Required by:
[capacitor]         project :app > project :transistorsoft-capacitor-background-geolocation
[capacitor]
[capacitor]         * Try:
[capacitor]         > Run with --stacktrace option to get the stack trace.
[capacitor]         > Run with --info or --debug option to get more log output.
[capacitor]         > Run with --scan to get full insights.
[capacitor]         > Get more help at https://help.gradle.org.
[capacitor]
[capacitor]         BUILD FAILED in 2s
[capacitor]         11 actionable tasks: 2 executed, 9 up-to-date
[capacitor]
[ERROR] An error occurred while running subprocess capacitor.

        capacitor.cmd run android --no-sync --target 39251FDJH00H4T exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
christocracy commented 5 months ago

Post your android/build.gradle

chriswatt commented 5 months ago

android/build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.2.1'
        classpath 'com.google.gms:google-services:4.4.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply from: "variables.gradle"

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

android/app/build.gradle file

apply plugin: 'com.android.application'

android {
    namespace "io.ionic.starter"
    compileSdk rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "io.ionic.starter"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        aaptOptions {
             // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
             // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
            ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    flatDir{
        dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
    implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
    implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
    implementation project(':capacitor-android')
    testImplementation "junit:junit:$junitVersion"
    androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
    implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'

try {
    def servicesJSON = file('google-services.json')
    if (servicesJSON.text) {
        apply plugin: 'com.google.gms.google-services'
    }
} catch(Exception e) {
    logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
christocracy commented 5 months ago

You failed to follow the required setup instructions linked in the readme.

chriswatt commented 5 months ago

@christocracy Do'h! you're absolutely right, apologies. Thank you again for all your work.