my eclipse ide can't compile my android program - java

am not new to java programming. I recently downloaded the android SDK to begin practice android programming.
my eclipse Ide hasn't really been friendly with me because, at first it refused to install the adt plugin I donwloaded. till I installed it from google. and now it find it difficult to run even the helloworld program. it gives me several errors.
something about */user/***/res/value/*.xml not found or dark theme something not found, appcompat.v7 no resoirse found .
and also do I really to install all the items in the android SDK before I can compile anything. because the file size of my android-SDK-windows file is way over 10gb. and it looks odd plus my data bundle has been exhausted.
thanks..

Welcome to android Platform
Question1: "my eclipse Ide hasn't really been friendly with me"
Practice makes you perfect. Eclipse is a good tool once you get to know it
Question2: "Do I really to install all the items in the android SDK before I can compile anything"
No, you just need any once of the API ex: API-14 install it
Question3: "It find it difficult to run even the helloworld program"
Download a sample project online import into your eclipse and run it if you are new to android
Happy Coding !!

when using eclipse for android development it will always gives you errors its a nightmare that ull get used to. first of all make sure that the theme is fit for the sdk version that you mentioned in the manifest and two make sure that you have downloaded all the required items in the SDK. and try and refresh the project few times or even restart eclipse.

Related

android.bat not opening Android SDK manager

Yes, this question has been asked before. But the solutions on the internet are not working so that's why I am asking it here. I'm guessing the solutions aren't working because I am using newer versions but I'm not sure.
Bit of Background: So I am making a small game in Unity. I have to test it on Android so I can check if there are any problems or not. So I check around the internet on how I may be able to do that. Turns out, I need to change the build settings to android and I also need JDK installed on my computer along with Android SDK Manager so I download them both. I did not install the Android Studio but just the Command Line Tools because many tutorials say that I do not actually need the whole Android Studio because I'm gonna be making the app in Unity not in Android Studio. So I do that. I install JDK and Extract the command line tools.
I think the JDK installed fine because after installing JDK, I opened Internet Explorer (No, I don't use IE, I use Chrome but I opened it just for fun). And a little notification showed up at the bottom which basically said that I could now run Java on the browser so that's why I don't think there are any problems with the JDK installation.
Problem: I extracted Command Line tools of Android Studio and found that there was only a tools/ folder in it. I opened it and clicked on android.bat but the Android SDK manager doesn't work. A CMD screen just flashes for a moment but then nothing happens.
Solution I have Tried:
Change set java_exe to:
set java_exe="C:\Program Files\Java\jre7\bin\java.exe"
and delete the line:
call libjava_find.bat
But I can't find set java_exe code anywhere in the file. The file doesn't have it. How am I supposed to change it?
Alright, so I figured it out but I was still unable to pinpoint the problem. Here is what I did:
Installed a fresh copy of Windows 10. Note: It is highly unlikely that this will solve the problem. But where I live, it is very common to just install a fresh copy of windows whenever you get a problem. I really don't think you need to do this.
Follow all the instructions from: https://www.youtube.com/watch?v=yLFBu-VlBIw
If you get the following error:
Error building Player: CommandInvokationFailure: Unable to list target platforms. Then use this fix: not finding android sdk (Unity)
These steps solved the problem for me and I was able to run it properly.

Debugging Android Studio 2.2 CMake vs NDK-Build

Today I downloaded the new stable version of Android Studio 2.2.
I want to using c++ debugging in my Android Studio Project.
When I start a new project, with the Include C++ Support selected within the wizard, I am able to create a hello-jniString program which debugs exactly as expected; both java and c++ breakpoints are hit..
However when open an existing project, click the project in the project panel and click "Link to C++ project". It seems to link and compiles changes well ... however, when I try to debug only Java breakpoints are hit :(
Any help into this would be greatly appreciated .. completely baffled at the fact that no real support/documentation exists for debugging ndk and that c++ ndk integration is so all over the place when Android seems so mature ..
I had slightly different case (debugging jni of library module, built by cmake), but you may try this.
Run > Edit Configuration > select 'Debugger' tab
add symbol directory of your debug symbol placed.
in my case, that was LIB_MODULE/.externalNativeBuild
I can debug c++ now but still finding how to turn off optimization option.
Good luck!
Following up on this incase someone comes by this,
I had to migrate Android/Application mk files to CMakeLists.txt.
Linked to c++ project within android studio, and 9 months later ... at last ... debugging capabilities

Totally manual Android compile

I have always used ADT to develop Android applications, but have moved to a new machine which does not have ADT installed. Google does not seem to support using ADT any more anyway, saying "you should migrate your app development projects to Android Studio as soon as possible". But Android Studio apparently uses Gradle which requires an Internet connection to compile, which won't work for me when I'm on the road, when I can download stuff to install if needed, but don't have an Internet connection when I'm actually working.
So as a work-around I am exploring the idea of not using an IDE at all and just manually compiling everything. (This also seems more future proof against the next time Google decides everyone needs to switch to a whole set of new tools.) I assume that to do this I need a few command line tools, for instance, something like "javac" to compile Java files into class files and next something to create dex file(s) and finally something to package everything together into an apk and sign it. However, when I search for instructions on manual builds I still find constant references to a build system such as Ant or Gradle. I don't want to use any build system!
From scratch, what is the minimum I need in terms of tools I need to download and figure out the command line invocation to turn a simple (let's say "Hello World" simple) java file (and a few support files like a layout XML file and manifest) into a working APK? (Note that I need to build an APK that will work on APIs as old as API level 10.)
Update: Ok, so far I have installed the standalone SDK tools, and have used the SDK Manager to install the SDKs that I need. But now I'm unsure of what commands I need to run: I'm familiar with javac and I see that, but I know there are other commands too. Again, I have seen several SO questions asking about how to build and it refers to things like the ant or android command, which are NOT in the stand-along SDK tools and which shouldn't be necessary if I just knew which commands to invoke manually.

How do you use a Java project in your Android project in Eclipse?

I'm writing an Android application and there's some Java code in it that's somewhat sophisticated and therefore hard to verify the correctness of in the Android environment. I would like to run this code in a desktop environment where I have more tools with which to examine the output of this code while still using it in my Android application.
My attempted solution is to have three different projects in Eclipse. My Android project and two plain (non-Android) Java projects. One Java project has the sophisticated code that I want to use in Android and the other is a test program that verifies the correctness of the former project. The latter project has already been useful in debugging the former.
However, so far, my attempts to use the Java project in my Android project appears to work in the IDE but when I actually run the Android application, the NoClassDefFoundError exception is thrown whenever I try to access any of the classes. Obviously, that code is not being recompiled into the .dex file but why not?
I could go into detail about what I've done so far but I can't help but think that what I'm doing is a pretty standard and simple thing and there's a plain way of doing it, even though I can't find anyone doing quite what I'm trying. Can someone describe to me how this is done?
Luckily, I found the answer to my own question and I thought I'd share it here to help others in the same situation. It turned out to be very simple...
What I was already doing would have normally worked, which should have been a big clue to me since I have actually done this before, successfully. All you have to do is, under your Android project's Properties > Java Build Path > Projects, add the plain Java project to your "Required projects on the build path" and then under Properties > Java Build Path > Order and Export, check the checkbox of that same project in the "Build class path order and exported entries" list and everything should just work.
From within Eclipse, there's nothing else you need to do to get this setup to work. It's only when you're compiling from the command line that you need to build Java Jars and import them as libraries but I'm not doing that (yet).
Finally, this wasn't working for me because I just happened to be compiling my plain Java project under JDK 1.7 compliance, while my Android project was compiled under JDK 1.6. This is verified by the output on the Console pane, reporting "Dx bad class file magic (cafebabe) or version." This error message goes away when both projects are compiled under the same compliance level and, not coincidentally, the Android program runs properly.
Thank you to everyone who tried to help and I hope this answer is helpful to someone out there!
Would it not work if you made your other plain java project into an Android project and use it to monitor the output on the device?

Error launching first test application: Android Packaging Problem?

Conversion to Dalvik format failed: Unable to execute dex:
wrapper was not properly loaded first
[project]
Android Packaging Problem
I've never worked with Java or eclipse before, I'm following this introductory guide and all searches via google return no helpful results. I'm guessing the problem is I have built Android stuff with eclipse properly but I have no idea, I followed this guide to the letter and everything went as it explains it should.
Any ideas what caused this problem, or is it specific to the guide? If so I'll post on their help page.
I have tried doing project -> source -> clean up, but that didn't fix anything.
Edit:
I went to Project -> Android tools -> Dex bytecode and it reported:
DexDump: missing classex.dex for project. Please compile first.
So I guess that's my problem! Not sure how to solve though.
Go to Project -> Clean
It will rebuilt workspace and fix the errors if any.
As I said, I had the same problem so I tried all the different versions and
then I stopped filling in the SDK-version number
and finally it did not complain anymore about the wrapper.
After that it was totally fine to write the SDK-version when I created new projects.
Hope it works out for you too.
Had the same problem (running on Windows 7). I resolved it by running Eclipse with Administrator privileges.
try to run eclipse under administrator permission. Problem may be resolve.
I think you installed the SDK in "Program Files" folder . So for do something inside, must have administrator permission.
One thing that may help is to create a new test Android project.
In Eclipse, select File → New → Android Project.
Set the project name to "Test3", check Android 2.3 for the build target, type "com.example.android.apps.test3" for the package name, and type "Test3Activity" in the "Create Activity:" text box. The form should look like:
Click Finish.
Expand the entry for "Test3" in the Package Explorer. Navigate to res/values/strings.xml. Double click on the entry for strings.xml:
Set the text content of the string element having name "app_name" to "Test3":
Right click on "Test3" in the Package Explorer and select Run As → Android Application. The emulator should open and after a long while, you should see:
If these steps do not work, then you probably have an error in your installation.
Try it out and let me know.
I had the same problem earlier today. Google was largely unhelpful.
I fixed it by removing the project from eclipse, then re-importing it.
According to this bug report the problem is caused by upgrading to version 9 of the SDK.
Had the same HelloWorld problem with Ubuntu 64 Lucid / Eclipse 3.5.2 from Ubuntu repository. Restarting Eclipse did the trick, though I notice it still fusses about API level requirement when HelloWorld is run.
Running it as Administrator has solved this issue for me..
Had the same problem - occurred after I tried downloading Android platform v2.3.3 (was using 3.1 and 3.2 earlier) and it interrupted in the middle - restarted eclipse and cleaned all projects and rebuilt and the problem went away
At what point in this tutorial/guide are you running into this problem and did you make sure to include your package information in each file or ie com.something.somethingelse at the top of your class or classes?
Perhaps a registry error or maybe even a problem with activity implementation.
Please post your code if this did not start you in the right direction.
Here are a few things to check:
Make sure you have the latest version oF Eclipse (Helios)
Make sure that you have the Android SDK plug-in for Eclipse.
Now if you have done that... Make sure that any classes you add (Each screen you view on Android is a class and is called an Activity) are in your androidmanifext.xml file See http://wrenbjor.com/2011/01/12/the-androidmanifest-xml-file/ for help on understanding this process.
otherwise make sure there are no red x's in your code or it wont work.
If you still have problems post some code and we can try to help.
Had the exact same problem the other night. Upgraded to Helios (3.6) and it went away, quite possibly as a side-effect.
Under windows 7, rather than run eclipse as an admin, change the permissions on the eclipse folder so the creator/owner has full control, and do the same with the folder the android SDK is installed into.
I had installed Eclipse using the files provided by Windows' native ZIP extractor. I deleted the files and took them from 7-Zip instead. Now the error is gone. So maybe using another ZIP extraction tool will help.
Recently got this when failing upgrade using adb-manager with eclipse open (win32). As eclipse was open, upgrade failed. Then returning to my project this problem occured.
Was solved by closing eclipse, restart as administrator and cleaned project.
I had the same problem but I resolved it using following steps(using eclipse helios and windows XP ) :-
Right click on eclipse.exe.
click on Run As...
Uncheck the checkbox before "protect my computer from unauthorized activity".
And it is running for me as expected !
hope it will also run for you.

Categories