Cannot remove NDK support from Android project - android-ndk

I am unable to remove NDK support from my Android project. I have gone through all the workspace and project settings, including CDT builder, C/C++ build paths, etc. I have cleaned my workspace and relaunched Eclipse. However, my project will not build as Eclipse complains about this error:
Program "/home/eazyigz/adt-bundle-linux-x86/android-ndk-r8c/ndk-build" not found in PATH
I really don't know what to do, as I don't even have ndk-r8c downloaded, and it's an outdated version of ndk anyway! I am on Ubuntu Linux.
Anybody knows?

Well, I reinstalled Eclipse. Then I deleted my project and re-imported it into the workspace. Now I don't get that error anymore. Problem solved.

If you have a C/C++ aspect to your code which references the Android NDK plugin for Eclipse, you need to have the NDK location set in the NDK plugin preferences:

Related

Android Studio ArticFox compiling fine but showing red errors everywhere

I have a multi module Android Compose project. One module is an android app, others are android libraries or kotlin libraries. I'm running AS Artic Fox 2020.3.1 Beta 5 on MacOS 11.4 Big Sur.
After a library upgrade (probably AGP to use compose, I don't remember when exactly) Android Studio started to show syntax errors everywhere, both in .kts and .kt files.
Compilation and execution are working fine, only those weird JDK errors are displayed.
Here are some examples :
in a .kt file from a kotlin library module, in a .kts file from the buildSrc module
It seems that there is an error with the JDK somewhere, but I don't understand how to fix it.
I Googled/StackOverflowed before posting here and I already tried :
to check the JDK used Project Structure > SDK Location > Gradle. It is using the Embedded JDK 11.0.10
to reinstall AS using Jetbrains Toolbox
to invalidate cache and restart
to clone my project again
to delete ~/.gradle
But none of those actions helped...
Thanks in advance !
Update 22/07
I tried to create a new empty Compose project with .kts support, but no luck, everything is in red
Because of a bug preventing to update, I updated manually to RC_1. Here is my current setup.
I tried to change from Embedded JDK to a separately installed OpenJDK 11 and reimport but not luck (#alexey-belkov suggestion)
I checked the logs but found nothing obvious (#andy suggestion)
ℹ️ Finally I tried to create a new empty Android project with only .gradle support, and no errors ! Could it be a kotlin script plugin problem ?

Android Studio “cannot resolve symbol R” but project compiles and runs

Android Studio displays in all java files in red : “cannot resolve symbol R” but the project compiles and runs.
I have tried every solution here:
Android Studio "cannot resolve symbol" but project compiles and works, but with no luck.
I tried to :
invalidate caches and restart android studio
delete .gradle and .idea folders
clean and rebuild the project
install a new version of android studio
mess up with gradle file then undo changes and sync project
One thing that I want to try, but I don't know how to achieve, is to reopen the project from scratch as I was opening it for the first time, but I don't know how to do this.
I also tried answers from here:
Android Studio says "cannot resolve symbol" but project compiles,
but again with no luck.
Android studio version = 3.2.1
dependency versions in gradle project file:
classpath 'com.android.tools.build:gradle:3.4.0-alpha01'
classpath 'com.google.gms:google-services:4.0.0'
For some reason that i do not understand ,
this combination of build versions made the issue :
grade version = 4.10.1
classpath 'com.android.tools.build:gradle:3.4.0-alpha01'
when i switched to these build versions :
grade version = 4.6
classpath 'com.android.tools.build:gradle:3.2.1'
The issue was solved !
File -> Close project
Open an existing Android Studio Project
Open you project
Hope it will work.
sometimes, R file is not generated because of package name on android manifest is not match with package module that you have.
Is any wrong syntax or spelling in your xml?
Check your layout or any xml file.
Android Studio seems to have a caching issue with R.java occasionally. I rarely have a problem with this, but when I do, I actually open R.java (double press shift and type "R.java") or navigate to R.java under "app/build/generated/source" directory, opening the file and checking if the relevant XML id has been created. If it has, it forces Android Studio to now recognise the id's that are not being resolved. It's quick to try, and doesn't require clean and rebuild.
From your programs menu, open android studio. instead of opening your project from the recent files, select to open a project from your computer and then locate the path to your project. When all else fails, sometimes this works.
Also, try commenting out the support libraries from your gradle implementation, sync your project, and after sync fails comment them back in and sync again. (not sure if that's what you tried already when you said you messed with the gradle file)
In my case,
I am using
- Android Studio version 3.3.1 at home
- Android Studio version 3.2.1 at office
When i pulled projects to my office computer that are firstly created at my home computer ,
Android Studio can not resolved R file but runs application with no error. Because projects gradle and Android Studio version are incompatible.
Only thing that you sholud do, change the gradle version in project level gradle file
classpath 'com.android.tools.build:gradle:3.3.1'
to
classpath 'com.android.tools.build:gradle:3.2.1'
I was facing same issue,
first thought the issue might because of some xml file or naming of drawable resources incorrectly. After analysing, this case wasn't applicable to me.
So
Updating Android studio from older version 3.2 to newer version 3.3.2 along with new build tool version from SDK manager resolved this issue
for me.
I've tried invalidate cache and Restart AS with clean rebuild all the options but didn't work for me.
It says cannot resolve symbol, but it can run.
In my case, I just reload the needed *.jar files to the libs folder.
File >> invalidate caches/restart
Rebuild Project
Sync
Run
Works for me!
It looks like the library did not load my "imports" properly the first time.
That's why the import methods cannot be seen in my main_activity.xml.
This happened to me when I was going back and forth between different SDK versions.
Apparently SDK manager copied all the source files but it didn't finish cleanly. As a result I could compile and run my project just fine but IDE didn't recognize the SDK and reported all java symbols unresolved.
None of the above and other solutions in SO didn't work for me, but just uninstalling/reinstalling the specific SDK version did a job.
If you renamed your package (inside java folder), make sure you change your Manifest package name to the same
The only thing that worked for me was,
replacing,
import package_name.R
with
import package_name.*
simply go to project settings : settings.gradel and change the rootProject.name to your current name
rootProject.name = "write the project name here"

Missing generated folders in Android Studio

I'm using Android Annotations in my project and I followed the instructions in this blog post http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/
Everything worked fine.
Today I updated Android Studio to latest version (build of 5th june). This requires an update of gradle build tools from 19.0.3 to 19.1.0. And i configured this in my build.gradle.
Annotaion processing still works. The generated files are located in build/source/apt. But this folder isn't visible any more in project explorer. And starting the build complains about the configuration.
But the project seems to run correctly.
This behavior is very annoying. Do I have to change anything in Android Studio? Has anyone a solution or is this just a bug in Android Studio?
The author of android-apt has already updated his plugin to support Gradle's new version, just change this line in your build.gradle
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
To
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.3'
The Android Studio Team changed the behavior of the IDE "for better IDE integration". Therefore the output directory of the apt-plugin v 1.2 will not be recognized as generated sources folder any more.
the plugin author knows about it and will provide a fix
https://bitbucket.org/hvisser/android-apt/issue/13/compatibility-with-011-android-plugin

How to import a android project into android studio?

I want to study the source code of android-smspopup .But when I download the source code and import this into android studio, the android studio pop up a dialog with a title"Import Gradle Project" and a blank to fill named Gradle home. Does any one know why this happens? And what to fill in Gradle home?
The source code doesn't include the Gradle wrapper files, which it should; the Gradle wrapper is responsible for automatically downloading the correct version of Gradle so you don't have to go through this trouble. I would recommend that you copy the Gradle wrapper over from another project into this source tree and use it. In another project that you've created with the New Project wizard, copy these files to the root directory of the project:
gradlew
gradlew.bat
gradle (directory)
When you open up the project in Android Studio it's likely to complain about the version of the Android Gradle plugin and offer to fix it for you; let it do that. If you're running the latest version of Android Studio (0.4.6 as of this writing), it's fairly smart about getting the versions of Gradle and the plug-in right, but in older versions it could get a little confused and have to ask you multiple times.
NOTE: instead of copying the wrapper files over, you can instead install a compatible version of Gradle and put the installation directory in when it asks for Gradle home. That will work, but be aware that Android Studio is very finicky about what version of Gradle it's compatible with; usually it requires a specific version that isn't forward-compatible, so for example, if it wants 1.10, 1.11 won't work. As you upgrade Android Studio you'll have to upgrade Gradle as well and it will be a bit of a drag; if you use the wrapper it's easier to make that change.
By the time Android Studio hits 1.0, it will sort out the version issues with Gradle, and it won't be so picky about version numbers, but in the short term, it's a limitation.

Rhodes setup and installation for Android in Windows

I am trying to install Rhodes for Android application development. I installed rhodes gem (version 3.2), Android SDK latest release and Android NDK (latest). I run "rhodes-setup" and gave the installation path of Java, Android SDK and NDK. When i try to run "rake run:abdroid" for a sample rhodes applocation, it shows as
"WARNING!!! Path to Android NDK contain spaces! It will not work because of the G
oogle toolchain restrictions. Move it to another location and reconfigure rhodes."
I moved to another location and tried a another version of NDK ( revision 6 and 6b). But still having error. Could please point out what i am doing wrong?
Thank u.
Make sure there are no spaces in the path, like the error message suggests.
Bad NDK Path
C:\Program Files (x86)\android-ndk-r4\
Good NDK Path
C:\source\sdks\android-ndk-r4\
Update the path to the NDK in the Rhodes build configuration files. Try running "rhodes-setup" again and pointing it to your new NDK path.
Just move your NDK folder to your root folder. I have it like this:
C:\android-ndk-r5b
Remember to configure rhodes setup after you have made this change and before running your program. You do this by running:
$ rhodes-setup
on the command prompt while in your app folder.

Resources