Trying to setup phonegap "Hello World!" project - java

Guys i am following this tutorial
but unfortunately, i am not able to configure it, I have stuck at this section:
"Open a Project in the SDK" .
After importing the project in Eclipse it shows 64 errors, most of them are related to packages like:
Description Resource Path Location Type
The import org.apache.cordova.ConfigXmlParser cannot be resolved WhitelistPlugin.java /MainActivity/src/org/apache/cordova/whitelist line 23 Java Problem
Edit:
Ok, I have followed this link:
http://docs.phonegap.com/en/edge/guide_platforms_android_index.md.html#Android%20Platform%20Guide
and skipped "Open a New Project is SDK".
and directly execute these commands in "cmd":
cordova build
cordova build android
cordova emulate android
It shows in cmd:
INSTALL SUCCESS
Unlocking Screen
Launching Application
LAUNCH SUCCESS
but in simulator there is no application launched.
Please guide me.
Thanks.

First the doc your're following is for an old version, you should have a look at the newest version : http://docs.phonegap.com/en/edge/guide_platforms_android_index.md.html#Android%20Platform%20Guide
Secondly, do you really want to open the project in eclipse? That's really not something needed unless you need to do some native dev in your app.
You probably can ignore the "Open a Project in the SDK" section and just use the CLI to build and run your app.
If you really want to use eclipse, I think you have this errors because you only imported your app but not the cordova libs. When you use the "Android project from existing code" wizard, make sure you select the platforms/android directory and then select all the projects, especially the CordovaLib project.
And last but not least, you probably don't need phonegap and should use cordova instead. I don't know why phonegap is still refering to eclipse. Cordova now recommends using Android studio instead and maybe importing in eclipse doesn't work anymore with latest versions of cordova/phonegap? check cordova docs here : http://cordova.apache.org/docs/en/edge/guide/platforms/android/index.html

Ok,
I found the work around from this link
I installed the "Blue Stak App Player" and after running this command:
cordova run android
It successfully installed and worked in "Blue Stack".
Thanx.

Related

Missing java build path option in eclipse

I'm developing a mobile app using phonegap.
When i tried to add third party java libs to android platform by right clicking on project in eclipse , there's no 'java build path' option for adding the java libs .
I believe Eclipse do not recognize phonegap project as a java project , so the option is not visible.
I wonder why most of the online tutorial show such option available in phonegap + eclipse project ? Did i miss something ?
or is there any alternative solution?
Phonegap should have this option, like any other project in Eclipse
If its grayed out then there may be an error within your project.
Can you provide any more detailed errors? Have you tried changing the build path target? Maybe double check to make sure its referring to your JRE as well?
I just realised that those online tutorial doing it in eclipse + android environment and I'm doing it in Eclipse + multi-platform JavaScript environment.
I thought eclipse is smart enough to detect the android code within the phonegap project .

ADT Eclipse imports cannot be resolved

I'm working on some Android projects for school and I brought them home to work on over the weekend. I downloaded ADT/Eclipse on my desktop here and picked the folder my projects are in as the workspace.
When I open up the classes in the project to work I just see loads of errors in the code, which stem from errors shown in the imports like
import android.content.Context;
Imagine error marks under "android.content". It's like this with all of imports and when I hover over them the little window says "The xxxx.xxxx cannot be resolved". I'm currently API 19 on my desktop here.
What's the problem here?
Oh, and another thing: in the little console tab-window it says "Unable to resolve target 'android-18'". Could this a cause?
Well if you have ADT installed, you probably don't have API 18 installed. You can install it from the SDK manager in Eclipse.
Another option is to change the app to compile with API 19.
Right click your project > Properties > Android > Select the version to compile with
You should install latest ADT Bundle from Android official website that is available at :http://developer.android.com
and after downloading , don't extract it to desktop , instead extract it to the folder where you have installed Java JDK(java Development Kit). Because PATH might be the problem..

Can we use Android studio for AOSP development?

Can we use Android studio for AOSP(Android Open Source Project) development, is there a way to do it. I didnt find one. anybody got any idea on this please ?
You can use Android Studio as a IDE for AOSP, since it's just a modified version of InteliJ's IDE.
from AOSP root:
make idegen && development/tools/idegen/idegen.sh
Then just "Open Project" in Android Studio and select the android.ipr it generated.
To import AOSP source in Android Studio or Eclipse, follow the full instructions here :
https://android.googlesource.com/platform/development/+/master/tools/idegen/README
What Pedlar suggested above is one way of doing it. I ran into lot of Jar dependency issues when I tried it with IDEA community edition (Android Studio is a fork of IDEA IDE). The IDE keeps prompting you about duplicate jars etc. The generated project includes framework Java sources as well as App sources. I tried to build an App project which resulted in broken AOSP build. IMHO, IDEA is a great IDE for Java development. But didn't work well with AOSP.
What worked for me is using eclipse to browse/edit/debug framework sources, but build the code from a terminal window. To avoid AOSP build breaks, please create a shadow dir of AOSP (i.e. lndir of AOSP) and use shadow dir for eclipse project.
This is explained at Using eclipse to browse/edit AOSP link in step by step.
If you are working on AOSP, you might want to check Debugging Android framework services.

How do I set my Java SDK when creating an Android project in IntelliJ?

I'm trying to get an Android project running in IntelliJ by following the JetBrain instructions here but run into an error message when trying to Select the Project Template (step #2). The error is
"Cannot Create SDK
You need to configure a Java SDK first".
I'm doing this on a mac and followed the first page of instructions before the ones linked above. In particular:
I ran the command tools/android update sdk --no-ui from the terminal after downloading only the Android SDK content. I mention this because it says to "run the SDK Manager", but I see nothing of the sort in what I've unpacked. Running the aforementioned command downloaded and installed many Android API versions and revisions.
The JDK I downloaded was jdk-7u17. I installed it; is that all I need to do?
The error for "configure a Java SDK first" comes up when I press the "New..." button in step 2. Does anyone know how I can configure my Java SDK? Is there something I missed or that is missing from the JetBrain instructions?
EDIT: Apparently, a file browser comes up after clicking OK. This confuses me further, as it accepts setting my JDK location but what I want is to view an Android project. My Android SDK is in the folder named "android-sdk-macosx", but that's not bringing up the Android options when it's selected. How do I get to the Android templates?
Have you downloaded some of the Android SDK's? Try running tools/android sdk (this opens the SDK manager) and download one of the SDK's. Then add this to your project.
Have a look at the IntelliJ documentation, which explains how to setup your SDK.
You have to setup a JDK first (see also Setting up JDK 7 for IntelliJ on the Mac), then you will be able to open your Android project.

Java eclipse run android project

im starting developing android applications and i learned from a Hello World tutorial. but when im running it this comes to the screen
Launch configuration ANSIBuffer references non-existing project Basic.
Please, help me and tell how i can run a android application.
Thanks
I would recommend downloading the official adt (android development tools) plugin for eclipse. You can find instructions on how to do that here: http://developer.android.com/sdk/eclipse-adt.html you need to make sure that you have the most recent version of android sdk installed before you do that. Instructions on how to install that are here (this includes a eclipse tutorial): http://developer.android.com/sdk/installing.html
I believe that that is all you need. Just ask if you need more help!
I did a guide once for a course, but it is in spanish:
http://otfusion.org/android/ (look for day 2)
But basically the guide is this:
Download JDK from here: Java SE - Oracle
Download Android SDK (.zip format, just unzip it in C:\android-sdk or if you are in *nix /home/user/android-sdk) from here: Android SDK - Developer Guide
Start ~android-sdk/tools/android and download your desired android target (eclair, donut, honeycomb, etc)
Download Eclipse for Java Developers* (as far I know, the latest eclipse WORKS on my notebook) from here: Eclipse - Indigo
Install eclipse in a readable/writable location like /home/user/bin or /opt/eclipse but give permission to the file - chown -r user:users /opt/eclipse (in Windows you must not have problems) otherwhise you will have problems.
Install ADT Plugin just add this site in Eclipse "Add Software" option (Help menu) https://dl-ssl.google.com/android/eclipse/
Restart Eclipse
Start one AVD and initiate your project using the Run button (As Android project) or whatever hotkey you use.
Also, Installing guide from developer.android.com Troubleshooting
*Note: Classic didn't work for me

Categories

Resources