Issue
I developed a few apps with Ionic framework (Angular). When I build an .apk file and install it to Android device then the new one app substitute (delete the old one) the old one installed earlier. When I develop native app in Android Studio I have no such an issue.
I searched Ionic documentation but this issue is not found. I have only suggestions that the issue will resolve after building with some flag (ex. --release) or signing the app's apk-file.
The ISSUE was the "android" folder had existed already. So I described the solution in the answer. This issue appear only if the app ID is not changed before the first android/ios adding.
Search for "com." across the project
12 results - 6 files
android/build.gradle:
9 dependencies {
10: classpath 'com.android.tools.build:gradle:7.0.4'
11: classpath 'com.google.gms:google-services:4.3.5'
12
android/app/build.gradle:
1: apply plugin: 'com.android.application'
2
46 if (servicesJSON.text) {
47: apply plugin: 'com.google.gms.google-services'
48 }
android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java:
1: package com.getcapacitor.myapp;
2
23
24: assertEquals("com.getcapacitor.app", appContext.getPackageName());
25 }
android/app/src/main/assets/capacitor.plugins.json:
3 "pkg": "@capacitor/app",
4: "classpath": "com.capacitorjs.plugins.app.AppPlugin"
5 },
7 "pkg": "@capacitor/haptics",
8: "classpath": "com.capacitorjs.plugins.haptics.HapticsPlugin"
9 },
11 "pkg": "@capacitor/keyboard",
12: "classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
13 },
15 "pkg": "@capacitor/status-bar",
16: "classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
17 }
android/app/src/main/java/io/ionic/starter/MainActivity.java:
2
3: import com.getcapacitor.BridgeActivity;
4
android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java:
1: package com.getcapacitor.myapp;
2
Solution
SOLVED!
- Delete "android' folder
- Change the appId to: 'io.ionic.yourApp' in capacitor.config.ts
- cmd
ionic cap add android(I rebuilt "www" folder too before this) That's all.
Answered By - Dziamid Harbatsevich
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.