Ionic Blank Screen in Browser and on Android - android

I got the task to check out an Ionic-Application and the Source-Code. I have a compiled .apk File which works perfect on Android. Now I checked out the project. It is written with Typescript and AngularJS, everything seems normal. I went into the Ionic folder and did ionic add platform android and then created a valid apk-File. However it doesn't work i only get a blank screen. The file size of my apk and the one which works is quite the same.
In Webstorm I tried running it in the Browser, by doing run-configuration and then Run Browser. There I also get a blank page. The top URL points to the right starting point. In the Developer Tools everything seems normal. I see all the Script Sources and Console-Messages. The only thing is, that he says he is missing the Keyboard plugin, but I guess, that's not really relevant.
So what are my options? There is no one of the Developers left in our company, so no one we can ask, how they compiled the App. There is a package.json, where there are cordova-plugins defined even the keyboard. There is also a gulp-file which seems to only compile the Sass and do something with Bower.
I can't publish the whole project, also because of legal issues, but what's my best option? I never have done something with Ionic, so it's hard to locate the Error.

I had a similar issue. My solution was to check out the code in a folder, go to that folder and then run
npm install -g ionic
If I didn't do that - I'd get no end of errors when trying to get it to work.

Related

Nativescript builds old code

I have angular 2 nativescript project and I use
tns livesync android --watch or tns run android
to see changes on both real device and emulator. It usually works fine but at some point it starts building and syncing old code and throws JS errors based on that code.
It's usually solvable by reseting the whole project (remove platforms, node-modules, hooks) and tns install everything back.
When I add new node modules and/or new custom components, I usually kill the lifesync and do the tns build android.
Regardless of this lifewatch serves old html and old js (transpiled from ts).
When I saw the output in the terminal I copied out the elements that caused an error and searched in the whole project for these elements. However they are nowhere to be found. First I thought they were still inside platforms folder, but no, so they must be cached somewhere. Has anyone noticed this as well? How to fix this / work around this ?
I am using Webstorm - tried invalidating cache and restart. Didn't help. Decided to switch over to Visual Studio Code, but it is doing the exact same thing. I have even deleted .gradle folder in order to delete cached files. Didn't help.
It seems this is fixed in next release (unfortunately not the current 2.2). Read up on their github . It was indeed the CLI syncing wrong files.

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

Phonegap (NOT Cordova) 3.5 sample app not firing deviceready

I noticed today that: sudo npm update -g phonegap showed that v3.5 was available. After doing this update, phonegap -v returns: 3.5.0-0.20.4
I then proceeded to create a sample app using the Phonegap CLI:
cd myProjectFolder
phonegap create HelloPhoneGap350
cd HelloPhoneGap350
phonegap local build ios (to add the ios platform)
phonegap run ios --emulator
At this point, the sample app launches. However, deviceready event never gets called. (I added some alert code and can see that the app.initialize() and app.bindEvents() get called. But onDeviceReady never gets called. I was also able to reproduce this with an Android build.
A few weeks ago, I went through exactly the same process with the previous version of Phonegap (v3.4.0-0.20.0) to create a HelloWorld340 which works fine and does call the onDeviceReady function.
I realize that the Phonegap 3.5.0 packaging of cordova 3.5.0 has only been out a few days. Perhaps it's a bug in the packaging? Anyone have any ideas or solutions.
Thanks!
well, im using 3.5.0-0.2.4 and it works like a charm.
perhaps you forget to inherit the cordova.js-file?
More interesting observations over the past few days. I went through the process to create a few more projects. (I'm migrating a bunch of old PhoneGap apps to the new PhoneGap 3.5 and it's easier to create new, sample projects and just move the existing HTML/JS/CSS code over...)
During this work, I noticed that - with a few specific steps - the generated project can fire "deviceready" out of the box. Here are the details:
I noticed that the phonegap.js file does seem to get put in the right place (yourProjectName/platforms/ios/www/phonegap.js) when the application is created from the command line.
However, upon first launch of the project with Xcode, it doesn't seem to be noticed even though it's in the "Staging/www" view within Xcode. However, if you following procedure, the rebuild in Xcode seems to notice that it's there and package up the right bits to push to the device/emulator.
CLI: phonegap local build ios
Xcode: Product - Clean <-- this seem to be the important step.
Xcode: Product - Build/Run
(Note, however, that the cordova.js file that appears in the initial creation of platforms/ios/www doesn't get removed. So, you end up with 2 copies of the same file with different names: cordova.js and phonegap.js)
With this approach, you don't have to edit the generated index.html solution (mentioned as another solution/workaround in this thread).
Thanks to the suggestion by brauchle_andi above, I dug deeper and found the problem and just reproduced it in a 'clean' generated project.
I am using PhoneGap 3.5.0-0.20.4
I generated a new project (details) below and the file cordova.js is placed in the proper platforms/ios/www folder
However, the generated index.html has a reference to loading the script file, phonegap.js. Editing the index.html to load cordova.js fixes this problem.
Seems like a bug in the PhoneGap packaging process.
Here are the steps taken to reproduce this problem:
Use npm to install (though I may have done an update, don't recall) PhoneGap 3.5.0-0.20.4
cd Documents/PhoneGapProjects (the folder where I put my Hello World programs)
phonegap create /Users/John_Arnold/Documents/PhoneGapProjects/HelloPhoneGap350A -i "com.phonegap.HelloPhoneGap350A" -n "HelloPhoneGap350A"
phonegap run ios --emulator
This creates the project with the problem described above. Editing index.html and re-running the project fixes it.

AngularJS, PhoneGap, ionic, grunt difference between web and mobile

Okay I am not sure what's going on...
I build a simple app using: "AngularJS, PhoneGap, ionic, grunt"...
After grunt:dist or grunt serve I see everything nicely working in the browser
BUT
when I try to run it with grunt ripple OR with grunt build + phonegap build android + phonegap run android I am able to see only the ionic header and no content... any idea what could be possible wrong? Because I have no idea what could causing it.
Is there something I need to take care when switching to mobile? or ?
The console is clean as well:
→ adb logcat | grep -i console
I/Web Console(28936): Falling back on PROMPT mode since _cordovaNative is missing.
Expected for Android 3.2 and lower only.:966
Ahhhhhhhhhhh found an answer!!!
As Eduardo mentioned there is a problem with the slash at the beginning of template path.
It should be:
templateUrl: "scripts/src/LandingPage/views/home.html",
Maybe someone will find it useful.
For more detailed explanation checkout Eduardo's answer.

Is the ChildBrowser plugin for Android supposed to run on the emulator?

Is the ChildBrowser plugin for Android supposed to work on the emulator? cuz I think I have everything setup as explained here but I dont have a real device to test it out. When running the app it doesnt trigger it after clicking the button. Ive put some console stuff there and is in fact reaching that point to run the script: window.plugins.childBrowser.showWebPage(url, true););
The iPhone version of the plugin runs beautifully.
btw, Im using the latest version of both phonegap: 0.9.4 and the ChildBrowser plugin. Thanks.
Nevermind :) somehow eclipse -as lazy as can be- needs to be aware of the ChildBrowser.java existence even though it's already there, stored at the proper place within the project!
Right. Eclipse drives the .apk file build so it needs to know about all of the files to include in the build.

Categories

Resources