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.
Related
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.
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
My App is based on the Ionic sidemenu starter project.
It works fine in a browser, but trying to run it on my Android device results in an alert with the following message:
[ERROR] Error initializing Cordova: Class not found
I tried the suggested solutions in this post, but none of them solved the issue.
To reproduce the issue, please follow the instructions here.
Any ideas what's going on?
Some info:
$ cordova --version
3.5.0-0.2.6
$ ionic --version
Installed Ionic CLI version: 1.1.1-beta3
# In browser's console
> ionic.version === "1.0.0-beta.9"
Related question: ui-router resolve behaves strangely in Ionic
I've had this error before. It can be tricky since it is super generic. I'm not sure if this is related, but after much trouble I was able to resolve my problem using these steps:
Make a backup of the .json files inside of your /plugins directory.
Remove the .json files in your /plugins directory.
Empty your platform directories.
Re-add the platforms you want.
Build your app again.
Also, I have my cordova.js at the very bottom of my body tag, not in the head as I've seen suggested elsewhere. Your mileage may vary.
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.
I am trying to generate trace reports with Systrace tool in the Android SDK, but I cant view the report in the browser. It is blank and does not contain any information. I read in some forums that I need to open the report in Chrome browser, I opened it with Chrome as well but the report is blank.
I have enabled USB Debugging from the Developer Options and device is running Android 4.2 and I am using DDMS tool from the Android SDK to generate the traces.
http://developer.android.com/tools/help/systrace.html
Firstly, if anyone is using Chrome v50.0+ on OS X or Windows, just try this please.
open chrome browser and go to "chrome://tracing"
in the tracing page, click load and select the systrace generated html file.
Secondly, I think it's a bug which is confirmed by Google.
It looks like this is because modern versions of Chrome have deprecated the Object.observe function[1][2].
For more information, please see this, https://code.google.com/p/android/issues/detail?id=57135
I also have this problem running chrome on linux.
It seems they have bug in the implementation of javascript drawing the results.
Check JavaScript console.
Mine says.
Uncaught TypeError: undefined is not a function
On Windows , I just can see the result by doing this:
get the trace.html
open trace.html with chrome browser and open the chrome's developer tools then i find out there is 3 error in trace.html
showing like this
go to the error line ,then comment the error function
like this
save the modified html then refresh chrome , you can see the trace result
This is just not the best solution, but any way we can see the result.
I was having the same issue when capturing through eclipse on Ubuntu 12.04.
Worked around it by running the tool directly from the systrace folder (sdk/tools/systrace/)
./systrace.py -t 5 -o trace.html
Update your SDK using SDK manager, select tools and platforms tools to be updated.
Follow the normal procedure, and that's it. Chrome is recomended to see results.
I solved this issue just by updating the SDK, use the SDK manager select tools and platform tools for update and you're done. Python script doesn't work on Windows.
However even if the trace.html is generated and it can be seen, when data overflows, it is not possible to see the bottom part of the page. This because wasd navigation is not enough making the use of the scroll bar needed.
To do this you need to:
If you're in Linux modify the Python script and eliminate the overflow:hidden wherever is found.
If you're using SDK, edit the trace.html and eliminate the overflow:hidden wherever is found.
Hope it helps, it'll be nice that someone in Google can fix this on the source.
I just found the my trace.html, which failed to open in IE/Firefox/Chrome, opened fine in the latest Opera (on my Windows PC).
For me, it didn't work on Firefox v34 but worked in Chrome v37 and I am on Ubuntu 12.04.
I also faced similar issues while trying to open a Systrace generated html file (around 10 MB ) on Firefox 37.0.1. However the same file works brilliantly on Chromium Version 37.0.2062.120 Ubuntu 12.04 (281580) (64-bit).
I've done following:
cd $ANDROID_HOME/platform-tools
git clone https://android.googlesource.com/platform/external/chromium-trace/
mv systrace old-systrace
ln -s chromium-trace/catapult/systrace/systrace/ systrace
that fixed my systrace issue
systrace report work in latest chrome at least
You can try my sample trace.html file to check if your Chrome version is okay or not.
https://github.com/tngotran/systrace-android/blob/master/trace.html
Also here is a link to the official trace.html sample from Google https://source.android.com/devices/tech/debug/perf_traces.zip
By the way, from my experience, the command tool python systrace.py can create an output file trace.html without error, but result is an empty file (even the file size is larger than 5Mb or more).
We have to:
Run the command adb root from your terminal to restart adbd as root
Run the python systrace.py again
Then check your created report .html file in Chrome :)
Suggestion: Try to trace an emulator (they are for development)
The issue may be manufacture customization to the Android OS, making the problem potentially a device configuration issue caused by the manufacture.
There are several answers that may be helpful here.
None of these worked for me... but because of answer https://stackoverflow.com/a/52379567/1815624
I found that it would load data by using the linked trace files:
Also here is a link to the official trace.html sample from Google
https://source.android.com/devices/tech/debug/perf_traces.zip
Using adb root did not work.
On a different device it worked flawlessly right off as well as using an emulator.