Android NDK - Eclipse can't include jni.h - android

So I'm using Eclipse 4.2 to build my projects which imports native functions in Java.
Everything build fine with eclipse and yesterday everything worked fine.
Today my eclipse stopped to resolve jni.h headers and others android header and shows me errors.
My project builds correctly but eclipse forbids me running application with message saying that there are errors in my application.
I have all paths to symbols in project paths and symbols c,cpp.
And it was working without errors... My only solution right now is to build project, then restart eclipse and run application...
EDIT: oh... It's funny... Now eclipse doesn't start android emulator when i click run as...
EDIT2: even when I create new project...
EDIT3: Its funny... I had to add in avd device... I don't know how it is possible but for two days I've been using it without device in avd and it was working... (I haven't change api or anything like this and I haven't touch AVD Manager)
EDIT4: Strange things happenes in eclipse... I still don't know why eclipse has problems with includes...

It's a bug in ADT 20. Refer http://code.google.com/p/android/issues/detail?id=33788
Go with Alex' adwise until ADT 21 or a patch for ADT 20 is released.
[edit] BTW: you can always simply delete errors in the Problem list ;-)

You can go to Project|Properties|C/C++ General|Code Analysis then uncheck everything in there. That will provide for running your app until you figure out the proper fix.

You can do this by choosing Properties for the project
Properties -> C/C++ General -> Preprocessor Include..-> Entries -> Setting Entries -> CDT User Setting Entries
Add -> Include Directory -> File System Path, and enter the path of the includes like:
${NDK_ROOT}\platforms\android-5\arch-arm\usr\include
Also I found that this working for me only if I checked "Contains system headers" checkbox.

Related

Exported Eclipse Android project won't run from Android Studio

I followed googles instructions and exported a test project from Eclipse by using the
Export -> Generate Gradle build files
opened up Android Studio and imported. After getting my support libraries working properly my project would compile with out any errors. My problem started when I tried to run the app on my device. When ever I try to run the app it directs me to use an AVD, never giving me the option to select my device. I obliged, created a new AVD but to no avail only to get build failed error. (I'll add the exact error when I can) NOTE: I can see my device is connected by clicking on "(6)Android" and the bottom left of the screen. I do see all logcat messages in verbose. I added android:debuggable="true"to my manifest but still nothing.
Confused I created a new project directly from Android Studio, hit run and bingo,...it gave me the option to use my device to run it or an AVD. Selecting either results in a successful launch of the dummy "Hello World" app. I think it may have something to do with build variants as my imported project doesn't specify "debug" vs "release" while the Android Studio generated project does.
Anyone else experiencing this?
I found the answer to my own question. Bit of a double whammy. Before installing Android Studio I updated my SDK via Eclipse (as recommended/required by google). Turns out by doing so a few items in my current projects got disconnected. ie. build paths, dependencies, ect. (you now have to place external Jar's in the src/libs folder)
Here is what I did to fix it.
In Eclipse, Preferences -> Java Built Path ->"Order and Export" tab. Make sure items are selected
If you have external Jars, manually copy and paste the jar in the libs folder of the project. (I did this in my Finder)
confirm the project launches via Eclipse
If it runs, export the project again by "Generate Gradle build files" (confirm overwriting existing files, if any)
5.Open Android Studio and re-import the project. Again, confirming overwriting of any existing files.
6.Next to the run bottom at the top of the screen click on the drop down next to your project name. Click "Edit Configurations..." and select "show chooser dialog" if not already selected.
clicked ok to exit,..and PRESTO!!! I finally have a successful project migration.
Hope this saves someone else time.
Cheers!
Yeah i have experienced similar stuff on Eclipse, its quite buggy. Since Android studio is based on it i would expect everything. Still the best solution to everything is to reload project, refresh project or restart IDE.

Eclipse/Android can't generate R files for any project

I am a new Android developer (4 weeks into porting my iPhone app to Android). I have 8 projects (the app, and 6 small UI experiments, and a vanilla Hello World project that I just created with Eclipse). All fail to compile, and the issue is that every reference to the generated file R is flagged as "R cannot be resolved to a variable".
Up until yesterday afternoon -- every project compiled and ran (albeit very slowly) in the Android emulator. I've changed something, and since yesterday, all projects fail to compile, all in the exact same manner "R cannot be resolved to a variable". I every case, the generated files are missing. I believe they disappeared as I tried to clean and rebuild each project in the course of debugging this problem.
Two things that I know changed when this problem started, but that I can't say caused the problem, were: 1) shifting to debugging on a real Android device (a Samsung Galaxy Tab 2, which worked like a champ after struggling with the slow emulators), and 2) allowing Android (and perhaps Eclipse) to update themselves from the web.
I've spent many hours trying other user's suggestions and none have helped. Most suggestions refer to file naming issues, xml syntax errors, but I haven't changed these files and filenames since compilation was working. I have tried:
cleaning and rebuilding the projects
checking for subsequent updates to the Android SDK (and there were 2 subsequent ones)
Eclipse->File->Android Tools->Fix Project Properties
making small source changes to force rebuilding
rebooting Eclipse, as well as the Mac host, adb, the emulator, the Android SDK Manager
deleting a project, restarting Eclipse, and adding the project back in (bad idea - this fails with an error "Failed to load properties file for project 'ListViewFragmentTest'"
creating a brand new Android App project, which has worked many times before, but now fails
There's something going systematically wrong, and while I won't claim all these projects are bug-free, they did run up until 6pm yesterday, and then all stopped compiling thereafter.
I wonder if anyone has other suggestions, before I embarking with a complete reinstall of the development environment?
My environment is:
Macbook Pro (OS X 10.7.5, 8GB RAM, 2.53GHx Core i5)
Eclipse (Indigo Service Release 2, Build: 20120216-1857) (too old?)
Android SDK Manager Rev 22
Android SDK Tools (22), Platform Tools (17), Build Tools (17)
API's 11-17, all up-to-date
Seems like lots of people experience trouble with missing generated files (R), and I have had trouble when I've had layout XML errors as well, but that doesn't seem to be causing this problem. Thanks in advance for your help!
I am not sure but you are facing issue of R.java file is not getting generated after updated with ADT rev 22.
If this is the case then here is the solution:
Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.
Check in the Java build path library, whether "src" check box is checked or not.
If you are using any additional Libraries then make sure libs/android-support-v4.jar is same for project as well as the Libraries.
Thanks everyone. None of these suggestions resolved my problem. And while I'm curious as to why it happened, I was more impatient with not making any progress. I've reloaded Eclipse and the Android tools (this time with the bundled version from developer.android.com), and everything is working smoothly again.

Why is my updated Eclipse / Android setup not building my APK anymore?

I had a working Eclipse setup with 3.6.2 and SDK tools from version 11, and it has been building my main project just fine for quite a while.
For a different project, I thought I needed to upgrade my SDK to the latest and greatest - at this point API 14 (ICS 4.0).
I cannot even reconstruct the steps I went through, but what happened was that my project would seem to build, but I would see that it would say that it was skipping a post-compiler step, and at the end I would have no APK.
I also noticed that it updated my .classpath so that the output path was bin/classes instead of .bin.
Along the way I tried updating my Eclipse to the latest version (Indigo 3.7.1) but this didn't help.
I solved the problem eventually with help from this post on the Google Android forum:
http://code.google.com/p/android/issues/detail?id=21031
For me personally the biggest issue seemed to be solved as follows (qutoe from comment 25 in the forum post)
"I seem to solve the problem with .apk files not being built automatically until run/debug is used (comments #10, #11 etc.). Go to Windows -> Preferences -> Android -> Build and uncheck "Skip packaging and dexing until export or launch" then restart Eclipse. Works for me."
But there is other useful material there. Different people with different projects seem to have different problems with this setup.
I still don't understand the change in the classpath, but it doesn't seem to matter.
In addition, I found a discussion of installing the ADT with Eclipse Indigo which was helpful here in Stackoverflow:
Eclipse Indigo - Cannot install Android ADT Plugin
I also found that I guess because of various uninstalls/reinstalls, for some reason it stopped excluding my .svn directories from the sources. This Stackoverflow post was helpful with that:
Why is eclipse trying to copy my .svn folders from src to bin, and how can I make it stop?
Finally: a tip for really and truly uninstalling Eclipse - everybody says there is no uninstall, and there isn't, but there is a directory that Eclipse leaves in your home directory (in windows 7 under c:\users\) called .eclipse -
Zap it if you really want to start fresh.
In addition, for less extreme measures, there is Project->Clean inside Eclipse, and you can invoke eclipse with "eclipse -clean" for additional cleansing effects. No idea what, but various helpful people along the way suggested trying that to solve problems.
Ah yes - when I first installed Indigo and tried to build, I got a warning that my Java Compiler Compliance level was not up to snuff, which was simply not true - I have only Java 1.6 installed on my machine.
See this post for somebody who had similar experience:
http://marakana.com/forums/android/general/374.html
For me, what worked was simply going to Project, Properties, Java Compiler, then click on Configure Workspace Settings, and click on Ok in the dialog. Didn't need to actually change anything. Just showed it that everything was ok!
Eventually I indeed did clean out my Eclipse and Android installations (including the aforementioned .eclipse directory, and there's also an .android directory in your home directory which you may want to erase if uninstalling the Android SDK Tools doesn't do that - this actually is uninstallable). Installed everything from scratch and then used the additional information provided above and now it's building my APK.
I hope this saves somebody the hours I spent getting my build back in shape.

Every project says error after Android ADT update

I updated to the newest Android ADT and now every project in my workspace says error though there isn't any in the actual files. Even a clean Android project says error even though I have double checked all the preferences and I haven't found any fixes though I have investigated every possible help forum many times.
I have gotten many random error messages and here are just a few: "Current file is not a match for the given config.", "Conversion to Dalvik format failed with error 1" (not anymore), "Invalid preference page path: XML Syntax", "Failed to load properties file for project *" etc.
All my projects worked before updating.
None of the following works:
Cleaning the project, deleting the project and importing again, deleting libraries and temporary files and fixing project properties, unchecking the Is Library, updating the ProGruad, updating the Eclipse, moving Eclipse to C:\Eclipse, changing API levels and supported Android versions and so on...
I have fought with this problem for some time now.
EDIT:
The following things don't work either: Removing LibraryName_src files (my project has none).
EDIT:
I unchecked a checkbox in the general preferences which made Eclipse to delay the packing (I'll check the name of that checkbox later) and the current errors went away but now it says that "Could not find *.apk!"
I had weird errors too after updating my ADT plugin.
I solved it by performing an Android clear.
To do so just right click on yout Android project:
- Android tools
- Clear Lint Markers
It worked perfectly for me.
Recently had a similar problem. Try this:
Problem after recently after updating the ADT for Eclipse:
In your app project, check for any linked source folders pointing to your library projects (they have names in the form "LibraryName_src").
Select all those projects, right-click, choose "Build Path"->"Remove from Build Path".
Choose "Also unlink the folder from the project", and click "Yes".
Clean, rebuild and redeploy the project.
It seems the reason is that some previous version of ADT linked Library project source folders to the "child" projects, and the current ADT/Dex combination isn't compatible with that solution anymore.
(Solution found here: "Conversion to Dalvik format failed with error 1" on external JAR)
I solved it!
My jump from ADT 13 to 15 was too big. I backed up my workspace, removed everything releated to android and made a totally new SDK and Eclipse install.
After that I still got an error but deleting debug.keystore removed it.
I used Eclipse Indigo (version 3.7) and updated the CDT (instead of ADT) plugin to the latest version (cdt-master-8.0.1.zip). I experienced the same build path issues for all the existing projects that were working before I did the update. The issues that I faced were two folds:
The required source library link is missing from all the projects.
I lost my default Android SDK location in the Eclipse settings.
Here is how I fixed these two problems:
For Problem #1:
In Eclipse, click on the “Problems” tab to show the list of build errors.
Find an error that indicates certain class is not found. For example: “ClassABC cannot be resolved”
Double click on that error line would bring up the source code with the offending line, with a red dot x mark on the left edge of that offending line.
Double click on that red dot x mark would bring up a list of suggested solutions. At the bottom of the suggested list is the item of “Fix project setup…”.
Double click on the “Fix project setup…” would prompt you to add the link source library that is needed for the current project. Simply add that missing library to the project build path and click OK.
Now, do a “Refresh”, “Clean” and “Build Project” should give you a clear build, if nothing else causes errors.
For Problem #2:
In Eclipse, select from the menu bar “Window/Preferences…”, and then enter the missing Android SDK location. Click on OK button. That’s it.
These two steps basically restore all of my projects to the normal condition.
So if anyone is has been struggling with this after the latest ADT Plugin revision 22.
Be sure to install the Latest platform-tools as well.
To do this
Go to C:{Android SDK Location}\android\SDK Manager
And install the missing packages

Android application giving a weird error in Eclipse

i put this question in this forum because i am not sure whether this is an eclipse error or an Android error.
yesterday i created an Android application using Google Maps and GPS on Eclipse and it build and ran successfully however today i wanted to do some modification to the code so i started eclipse but it gave me an error.
SDK parse failed
if i try to run it. it says the apk cannot find. how can that be happened? the same application ran successfully on the same environment yesterday. i am using Ubuntu 10.04
Thanks !!
There is a problem with your project, as evidenced by the red x icon on your project title bar shown in the image above. Right-click your project, choose Properties and go through all your properties to make sure they are all still valid. It might be a reference to one of the jar files.
I get this problem all the time, hopefully my solution works for you.
To work around, goto your libraries inside the properties page.
Add any library and then rebuild your project.
Go back and remove the library later for clean up.
The project should still build.

Categories

Resources