Ionic 2 Android release app not working - android

I am facing a really weird problem with my APK release.
First ionic Deploy it's always undefined, it seems that is not injected.
Second, if I open and close the app several times I get a messages saying that cordova it's not loaded.
The most weird thing is that happens only with the android release, but it works perfectly with android debug.
Any help? Please? Thanks.

check your main actvity and xml are of same name and make sure that it has been declared in your manifest properly.
now 1. clean your project once
re-build your project
now generate your apk.

Guys I found the issue.
If I run this command he apk works perfectly
ionic build android --release
but if I run
ionic build android --release --prod
the size of the apk it's different and gave me that problem.

The problem for me seemed to be with the "pageName.component.ts" file that is created when you use the "ionic generate page" command.
Create your pages manually and run it (ionic run android --prod) or (ionic run android --prod) again.
it worked for me.
Home they fix it soon.

Related

Nativescript 8 Screen freeze after splash screen is loaded in release build

Guys I'm working on one of my own projects, and I'm using
nativescript 8.2.1 along with angular 13.2.0
I had some weird issue that is when we run the project using the following command
"ns run android"
application getting compiled and running on emulator fine.
but if I build to production and run it on an emulator I can only see a blank screen or white screen, here is the command used for that
"ns run android --clean --release --key-store-path "PATH/my-release-key.keystore" --key-store-password myPass --key-store-alias myAlias --key-store-alias-password myPass"
this is screenshot
This is what my root route looks like, redirection to home route is not working. but I tested if I add a button to app.component.html then I can see that button on the emulator screen. but routing is not working
This issue is caused when we only build with --release command otherwise debug mode it's working fine.
need your help on this
After spending multiple days of debugging, I finally, figure out the reason why the production build screen is getting frozen.
This is happening due to Firebase
I configure the firebase to my app referring through Nativescript version 8 documentation, here is the configuration that I have did
https://docs.nativescript.org/plugins/firebase-firestore.html
npm install #nativescript/firebase-firestore
//importing firebase modules
import { firebase } from "#nativescript/firebase-core";
import "#nativescript/firebase-firestore";
//Initialize firebase as per nativescript documentation
await firebase().initializeApp();
in debug mode, this is working fine without any issue, but the production release builds it's not working.
For resolve this issue. I used a different firebase package.
here is the documentation link https://github.com/EddyVerbruggen/nativescript-plugin-firebase
if you are NativeScript 7+:
tns plugin add #nativescript/firebase
for NativeScript 6:
tns plugin add nativescript-plugin-firebase
Thanks..

How to diagnose white screen on startup on Android device

I've been developing my Ionic 2 app, running in the browser, and also running fine on the device with the debug build. ionic -v gives me 2.2.1, and in package.json have...
"ionic-angular": "2.0.1",
"ionic-native": "2.4.1",
I wanted to start to test out a release build. I have create the keystore file etc and did some release builds.
Initially, I used ionic build android --release and installed this, and everything worked fine. After I discovered this does not minimize, and to do so I then built using ionic build android --prod --release. Looking in the .apk it is minimized as expected. I install it and the installs works fine.
However, when I run it, I just get the splash, and then a white screen, and that is it. I simplified my app.component.ts to remove all my startup logic, so I just hardwire to a new new near blank page, and now have nothing but the following in the MyApp constructor...
this.platform.ready().then (() => {
StatusBar.styleDefault();
Splashscreen.hide();
});
Still nothing. I created a blank app, and tried the same build (ie ionic build android --prod --release), and that worked fine.
So, there must be something in mine. But this only occurs in the minified release, so I can't debug into it (or didn't seem to be able to). I am not sure how to track down what the error could be. Are there any startup logs etc?
Does anyone have any suggestions?
Thanks in advance!

Ionic build succeeds but does not create .apk file

I was always able to build from this project, this just started happening this morning. When I run ionic build android everything runs smoothly and the build succeeds, but the date modified on the android-debug.apk file stays the same, and I don't see my changes when I run it on a device.
Could it have something to do with messed up permissions and somehow it doesn't have permission to write the apk? I'm running Ubuntu-server 14.04.4.
I know it's been answered before but I'm adding this to let you guys know what I've tried and how it's not working anyways...
I've also faced same issue and tried several things like
Renaming APK file, expecting it will create new one.
Deleting build folder, expecting as usual will create new one.
opening project in Android studio, expecting it will create new one when I use it to launch the APK to device.
I've tried calling ionic prepare platform before calling ionic build.
The ionic build is a proxy for cordova build command.
But in this issue all of above approaches were failed.
The reason I can see behind this is because of no proper response/function of added platform to your project, as when you build it's cordova platform android's responsibility to prepare build on your command. Which is not working.
Lot of people suggests that You need to us ionic/cordova restore, this will restore your state.
Another way is you can use Android Studio's build APK option which helps you not to disturb your plugins by restore or reset commands.
Hope this helps you save your time from trying all these approaches.
Could it that you are looking at a wrong place?
When build command is successfully finished you should see smth like below in console
Built the following apk(s):
<PATH_TO_YOUR_SOURCES>/platforms/android/build/outputs/apk/android-debug.apk
Are you checking this this location?
Okay so the problem isn't with Ionic, it's just that the changed files aren't showing up in the ftp for some reason. So now I will try and figure that out.
As suggested by #mobileevangelist , ionic cordova restore can be done using command
ionic cordova prepare
It fixed my problem.
Try to
Open Android Studio
Choose Import project
Select YourProjectDirectory/platforms/android folder
Choose Build -> Build APK

Ionic Build or Ionic Run builds the wrong app

I am trying to build or run an Ionic Cordova App. But it always builds a default app with playlists.
OS is Windows 10
I do the following from my command prompt:
c:\users\martijn\documents\ionic start testapp blank
c:\users\martijn\documents\testapp\ionic run android
now it is building a different app then in my app directory. When I do ionic serve I see the right app in my browser. Can't figure out why running or building gives me a different app, I think it is a default example app.
Can somebody help?
See link here:
https://github.com/driftyco/ionic-cli/issues/1283
Appears you may have to delete the the last apk file from platforms\android\build\outputs\apk

phonegap/android: changes to index.html not being regarded when building the app

I'm making my first steps in phonegap. I've been able to set up a project, install a plugin and build the app on my phone without errors. However, now, when I try to change the layout of my www/index.html in the project's root platforms/android/assets/www/index.html stays untouched whenever I (re)build the app.
I'm basically working in eclipse, only for html and javascript I use sublime. I've searched now for a couple of hours for a solution. The most promising approach was this thread: Changes to HTML files not showing on built phonegap 3.0 app ... but even that didn't work.
What can I have done wrong? There's no error, no warning (none resulting from the build process) and I don't know how I could debug the issue. I'm currently using phonegap/cordova 4.2.0
Any clue? Thanks
I still don't know the reason for my problem. However, installing the app via cordova CLI rather than eclipse seems to have solved the problem:
$ cordova prepare android
$ cordova run android

Categories

Resources