Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import existing Android project results in a lot "bugs" in JNI folder

I have an eclipse project with native library and I need to copy this project into another machine.

I coping this project folder there and use "File->New->Android Project from Existing Code". I also using tick "Copy projects into workspace".

Then I go to jni folder and see a lot of bugs like "Unresolved inclusion: ", "Type 'JNICALL' could not be resolved", "Method 'GetStringUTFChars' could not be resolved", etc. 31 errors at all.

I trying to compile this jni library. No problem. It has compiled but I still see all bugs which I see before. I trying to launch android application and it saying me that my project containing errors.

This problem only with a native libraries.

How to fix this?

like image 206
Andrew Avatar asked Dec 31 '25 17:12

Andrew


2 Answers

Go to Project Propriets >> C/C++ General >> Paths and Symbols and Add:

"/home/ademar/android-ndk-r9/platforms/android-18/arch-arm/usr/include" 

you can include de x86 and mips version too:

"/home/ademar/android-ndk-r9/platforms/android-18/arch-x86/usr/include"
"/home/ademar/android-ndk-r9/platforms/android-18/arch-mips/usr/include"
like image 193
ademar111190 Avatar answered Jan 02 '26 06:01

ademar111190


When you get stuck with these error messages from Eclipse, you should simply go to the "Problems" view and delete the messages. Clean build the project, and the messages will (hopefully) not appear again.

Sometimes, more radical measures are required, like opening a new workspace (simple delete project + import it back may not be enough, because some project metadata is not removed on delete).

The last resort is to go to the project properties, find the Builders tab, and disable the last Scanner Configuration Builder. Unfortunately, this will also disable "Open Declaration" and other smart source navigation features.

like image 21
Alex Cohn Avatar answered Jan 02 '26 06:01

Alex Cohn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!