NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Guide to setting up the Android SDK for Android development

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
AeneasTroy



Joined: 04 Oct 2012
Posts: 14
Location: Indianapolis

PostPosted: Thu Oct 04, 2012 8:01 am    Post subject: Guide to setting up the Android SDK for Android development Reply with quote

How to Install Android SDK on Netbeans 7.2

Please read the directions thoroughly before installing

If you have never used netbeans before, please
don't try to use this plug in. Wait until
you are familiar with the IDE first.

I. INSTALL AND SETUP ANDROID SDK

1. You need to download the Android SDK:
http://developer.android.com/sdk/installing/index.html

2. Install the Android SDK to C:\Android\android-sdk

3. Run Android SDK and install the recommended installations.
If you want to use your programs on your Android device, I suggest
installing the emulator for your device as well as the emulator for
the newest Android versions.

II. SETUP ANDROID VIRTUAL DEVICE(AVD)

4. In Android SDK, go to Tools> AVC Manager.

5. Create a new Android Virtual Device(Emulator). Name it whatever you want.
Set the target to the version of Android you want to emulate.

6. Set the size of the virtual SD card to whatever you want. For my first
Emulator i set it to 100 MB.

7. Set Snapshot enabled to true to speed up future loading time. This takes a
snapshot of the Emulator State on closing so that it does not go through
the startup animations.

8. Finally, click Create AVD at the bottom.

III. TEST YOUR ANDROID EMULATOR

9. Still in the AVD Manager, click Start.

10. You will see that Save to snapshot has been selected.

11. If you want it to load from that snapshot everytime, select
"LAUNCH FROM SNAPSHOT"

12. The emulator runs very slowly, especially the first time
with the startup animations. You will get used to it after awhile.

13. You should get to the menu screen.

14. After checking that everything is okay, you can test out
the emulator, or exit out.

15. Exiting saves a snapshot, which takes awhile. After taking the
first snapshot, it is okay to uncheck the "Save to snapshot". You really
don't need to do it after the first time, unless you want to save info
to the emulator for testing purposes, such as adding phone numbers, etc.

IV. INSTALLING THE PLUGIN ON NETBEANS

16. Start Netbeans. Go to Tools->Plugins->Settings
This is a list of all the places your plugin manager checks for updates.

17. Add a new update center: http://kenai.com/projects/nbandroid/downloads/download/updatecenter/updates.xml
this is the home of the NetBeans Android project.

18. After installing, go to Tools->Plugins->Available Plugins. There
should be a new plugin called Android. Install it. It is only about
700 kb.
I have had problems with the test runner on Netbeans 7.2. I think
the Test Runner for Netbeans 7.0 isn't compatable with 7.2.

NOTE: On previous versions, you had to add Android to the Tools->Java Platforms.
(I Think). You don't need to do this anymore.

19. Go to Tools->Options->Miscellaneous->Android
There is now an android tab in your options. Set the location
of your android SDK installation. Mine is C:\Android\android-sdk

20. You should now be able to create an Android Project. File->New->Android->Android Project

21. Name your Project.

22. The convention for naming an Android Package is different than for
normal Java Projects.
WRONG: "MyPackage" //ERROR!
RIGHT!: "My.Package" //GOOD!
This is what it means when it says "Package name must have at least two parts"

23. This is the source code for your main file:

package bl.ah;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

24. add import "My.Package.R" where My.Package is the name of your package.

25. After Building, you can press Start to startup your android emulator.


YOU CAN ALSO INSTALL A PACKAGE MANUALLY
This is good practice anyway.

26. Use the explorer to go to your project folder. In the bin folder,
you should find a .apk file. This is the compressed version of your program.
It works sort of like a .jar file.

You can install it manually onto your emulator from the command line(start->search->cmd.exe if you haven't
used the command line before. It can also be found in c:\windows\System32 or SysWOW64

26. If you know how to set system variables, add C:\Android\android-sdk\platform tools; to your path
26.b. If you don't know how, use the commandline: cd C:\Android\android-sdk\platform tools

27. In this folder is adb.exe. This is the android debug bridge.

START YOUR ANDROID EMULATOR NOW
28. In the command prompt, type adb install C:\{path to project}\bin\{projectName}.apk

EX: adb install C:\Sean\aa1\bin\aa1-debug.apk

29. You should get 3 lines saying how large the installation file was,
where it was installed, and whether it was successful.

If it doesn't print this, either you typed in the instructions wrong, or you had an error.
Here is more information about android bridgehttp://developer.android.com/tools/help/adb.html


NOW, Run your android emulator.
There should be an app named MainActivity. It was named after the class
name. The icon is the green android.

-----------------------------
CONGRATS

-----------------------------
If you have any problems, this is the place to post them!


----------------------------
For information about making GUI's I have found this page to be useful:
http://developer.android.com/guide/components/fundamentals.html
Back to top
jwalt



Joined: 30 Nov 2012
Posts: 1

PostPosted: Fri Nov 30, 2012 6:19 pm    Post subject: Emulator is not running through NetBeans Reply with quote

I have installed the plug in and emulator, and I have run the emulator through the AVD manager and it works. My problem is that it is not connecting with netbeans. Under my services tab, there is nothing under the Android Devices. If I restart the ADB, I get a message that says that the Android Debug Bridge has failed. Any advice would be helpful.
Back to top
Ragavan



Joined: 29 Dec 2012
Posts: 8

PostPosted: Sun Dec 30, 2012 6:09 pm    Post subject: Android set up in PC Reply with quote

Its quite simple just follow the steps in this blog to set up Android in PC, Netbeans, eclipse, IntelliJ

http://www.compiletimeerror.com/2012/12/configure-android-on-pc.html Smile


Last edited by Ragavan on Thu Mar 07, 2013 5:56 pm; edited 1 time in total
Back to top
shanethehat



Joined: 29 Jan 2013
Posts: 1

PostPosted: Tue Jan 29, 2013 10:13 am    Post subject: Reply with quote

Is there an easy way to import an existing ADK project created in Eclipse?

I have a Cordova (PhoneGap) project that I was working on in Eclipse, but the Android project dialog only seems to allow for creating a new project. For PHP projects there is an option to create a new project from existing sources, does the Android plugin support something similar that I've missed?
Back to top
junehemens



Joined: 20 Feb 2013
Posts: 1

PostPosted: Wed Feb 20, 2013 11:07 am    Post subject: Reply with quote

This would be a great achievement if you can implement this via android app development with IOS module.
Back to top
rro4785



Joined: 23 Feb 2013
Posts: 1
Location: Caracas

PostPosted: Sat Feb 23, 2013 4:22 am    Post subject: Re: Guide to setting up the Android SDK for Android development Reply with quote

AeneasTroy wrote:
How to Install Android SDK on Netbeans 7.2

17. Add a new update center: http://kenai.com/projects/nbandroid/downloads/download/updatecenter/updates.xml
this is the home of the NetBeans Android project.



The official site is: http://www.nbandroid.org/p/installation.html

If you want install in Netbeans 7.2 o greater, you need use:

http://nbandroid.org/release72/updates/updates.xml

No:

http://kenai.com/projects/nbandroid/downloads/download/updatecenter/updates.xml

That's all, anyway, Thank you AeneasTroy by the post.
Back to top
addy2white



Joined: 17 May 2013
Posts: 1

PostPosted: Fri May 17, 2013 8:54 am    Post subject: monetize apps Reply with quote

Reported post
There's a new offering to monetize apps. It's not badly paid and I tested it already. You can check it out- http://www.starapplication.com/ Smile
Back to top
gross_atuin



Joined: 22 May 2013
Posts: 1
Location: Germany

PostPosted: Wed May 22, 2013 9:02 am    Post subject: Re: Guide to setting up the Android SDK for Android development Reply with quote

AeneasTroy wrote:
How to Install Android SDK on Netbeans 7.2

24. add import "My.Package.R" where My.Package is the name of your package.
...
...

-----------------------------
If you have any problems, this is the place to post them!


Dear AeneasTroy

I've set up almost everything as it should, the Android emulator comes up
when I "run" the app from NetBeans. But: I then cannot find the app within
the emulator. Sure, I could go the external way to install the app either in
the emulator or in my mobile phone, but I still hope that I can get this last
thing to work properly, too.

Maybe I did miss your point 24 telling I should import my new package
somewhere. But where should I place the import line? When I set it into
my mainActivity.java NetBeans warns that I want to import the package
while this line is part of it, and it offers to delete this line.

Or - in a shorter way: How can I get my compiled app to work immediately
within the emulator by pressing the "run" button?

Best Regards,
Martin

P.S.: I'm using NetBeans 7.3 currently
Back to top
VentureHire



Joined: 18 Aug 2013
Posts: 1
Location: Bangalore

PostPosted: Sun Aug 18, 2013 6:25 pm    Post subject: Awesome post Reply with quote

Thanks Aeneas Troy. I am PHP developer and working on Netbeans.
Your stepwise instruction helped me a lot in installing Android SDK on Netbeans.

Keep Posting such an informative instruction.

VentureHire
Back to top
ajeh



Joined: 28 Aug 2013
Posts: 26

PostPosted: Mon Oct 14, 2013 10:55 pm    Post subject: Reply with quote

I've installed Android SDK, created AVD, it works.
Installed SDK into Netbeans 7.4 and created the first project.

When I compile the generated project and run it, this is what I get and the AVD simply has black screen. Is that normal?

Code:
ERROR: ld.so: object '/usr/local/lib/libundel.so' from LD_PRELOAD cannot be preloaded: ignored.
failed to create drawable
failed to create drawable

Back to top
hoppithek



Joined: 31 Jan 2014
Posts: 1

PostPosted: Fri Jan 31, 2014 6:24 pm    Post subject: Win 7 / NetBeans 7.4 Reply with quote

Followed your instructions.

Installed the SDK for all users, I believe that is the reason why I had to add a Variable to get the AVD running
Code:

SETX ANDROID_SDK_HOME="%HOMEPATH%" /m

Because I wanted to use adb from the command line I also had to add the path to adb.exe to the PATH Variable
Code:

SETX PATH=%PATH%;C:\Program Files (x86)\Android\android-sdk\platform-tools /m

If you prefer doing it with a GUI go to Control Panel > System > Environment > System/User Variables and edit exisiting or create new if no variable of the name is already there.

I also got an error from NB after creating the first Android Project, requesting I import android.R, but that was not really needed. Adding the import and removing it again (save the file) solved the error, that R could not be resolved.

Here is my output from the install:
Code:

E:\nb\TestApp\bin>adb -e install TestApp-debug.apk
48 KB/s (37514 bytes in 0.752s)
        pkg: /data/local/tmp/TestApp-debug.apk
Success


Thanks for the guide.
Back to top
applec



Joined: 21 Mar 2014
Posts: 9

PostPosted: Mon Mar 24, 2014 7:06 am    Post subject: detector Reply with quote

The mobile vehicle inspection ,you can get more details at detectorall.com
Back to top
joemayo



Joined: 09 Apr 2014
Posts: 1

PostPosted: Wed Apr 09, 2014 1:09 pm    Post subject: Android Update Center in Step 17 dpes not provide updates for Netbeans 7.4 Reply with quote

I added the update center in step 17:

17. Add a new update center: http://kenai.com/projects/nbandroid/downloads/download/updatecenter/updates.xml
this is the home of the NetBeans Android project.

But I did not fidn the Android option as stated in Step 18. So finding the Android tab later described is also missing and hence I cannot configure my Android SDK to Netbeans.

Is the update center provided correct or should I be referencing another one? Is the update listed as something else and not Android?

SOLUTION:

The update center url is now:

http://nbandroid.org/updates/updates.xml

It is explained at this site:

https://kenai.com/downloads/nbandroid/README.txt

Followed by this site:

http://nbandroid.org/wiki/index.php/Installation
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo