ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.09k stars 13.51k forks source link

'ionic cordova run android' removes dependencies from build.gradle on android platform #15837

Closed StefanoMartella closed 6 years ago

StefanoMartella commented 6 years ago

Hi,

I implemented a Notification Extender Service to manage icoming notifications when my app is killed, I need to store them in a database to retrieve their content when the user reopens the app. To store notifications I overwritten the onNotificationProcessing method of NotificationExtenderService class and through Room Persistence Library I store them in a SQLite database. In order to use Room Library I added the following lines to my build.gradle:

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    implementation(project(path: ":CordovaLib"))
    compile "com.google.android.gms:play-services-base:11.0.4"
    compile "com.google.android.gms:play-services-ads:11.0.4"
    compile "com.facebook.android:facebook-android-sdk:4.+"
    compile "com.android.support:support-v4:24.1.1+"
    compile "com.onesignal:OneSignal:3.9.0"

    // I ADDED THE FOLLOWING TWO LINES
    implementation "android.arch.persistence.room:runtime:1.1.1"
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"

    // SUB-PROJECT DEPENDENCIES END
}

Now, if I run my application through Android Studio everything goes fine, but if I try to run 'ionic cordova run android' from command line the lines I added are deleted during the process and then I get missed room persistance library error.

What am I doing wrong? Thanks for your help

EDIT:

I did not read this comment:

/*
 * WARNING: Cordova Lib and platform scripts do management inside of this code here,
 * if you are adding the dependencies manually, do so outside the comments, otherwise
 * the Cordova tools will overwrite them
 */

Sorry

paulstelzer commented 6 years ago

Could you please close this issue :) And btw, that has nothing to do with Ionic, that's Cordova ;)

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.