I have include directories and static libs outside of my Android Studio project that I want to reference. Have looked at the docs but no dice. (The closest thing seems to be reference to "Link C++ Project with Gradle" which simply does not exist as an option inside the editor)
Android studio v2.2.0, Gradle 2.14.x
How do I do that?
Related
I there:
I am working in the last version of Android Studio, and I have the next problem. I am generating code (.java classes), so my code is generated outside Android studio and copied into the folder of the project. When I try to run the code, it shows the following message
error: cannot find symbol class XXXXX
Where XXXXX is a class that exists (I tried with other classes and it happens the same). The class is well defined, its visible by Android Studio but it still fails.
The code is generated, so it is copied directly into the folder of the project and I think it is the problem.
What I tried to do: (according to other answers).
Rebuild the project.
Close and open Android studio.
File - Sync with file explorer.
File - Sync Project with Gradle Files.
File - Invalidate Cache Restart.
And those solutions do not work.
However, this works:
Create a class using Android studio and now I can generate the class and replace the file. Apparently, Android Studio (or Gradle) is unable to recognize a file created outside Android Studio.
What I can do?.
I need to create many classes so I can't create each file manually.
Is there are an internal database?.
Recently after upgrading Gradle Android Studio automatically added this to my .idea/gradle.xml :
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
What is the purpose of this change?
First there is several points to understand:
The file .idea/gradle.xml is used by Android Studio to store the Gradle project settings.
According to the Gradle documentation:
A composite build is simply a build that includes other builds.
According to the documentation of IntelliJ IDEA on which Android Studio is based, there is two ways to define a Gradle composite build either through the IDE or through the settings.gradle file.
According to the source code of IntelliJ IDEA the value of compositeDefinitionSource can be either SCRIPT or IDE.
To answer your question, the purpose of the compositeConfiguration element in the .idea/gradle.xml file is to define as a default the Gradle composite build by script. If you set a Gradle composite build through the IDE this value will change.
I'm working on a project in Android Studio 3.1. I first had to create a .jar file with dependancies in IntelliJ 2017.2. I chose to do my programming in the IntelliJ IDE because I knew that Android Studio is based on IntelliJ.
But now I have a bunch of scratches (lots of notes and code) for my project that I assumed would be available in Android Studio, but they are not.
Is there a way to tell Android Studio to use the scratches from IntelliJ? I will have to be jumping back and forth more and more between IDE's in the future as the project develops.
It's is possible to specify a location for scratches using Help | Edit Custom Properties... and adding the following property there:
idea.scratch.path=~/Scratches
It is necessary to restart the IDE after you make changes there. You could specify the same location in both IntelliJ IDEA and Android Studio. (You can of course choose your own path/location.) In this directory two further directories will be created by the IDE, "scratches" and "consoles". You can create these directories yourself if you already have scratches you wish to use.
The code completion is fine on Android Studio java project. But I want to use Android Studio to edit some existing C file(.cpp).
for example, if i have declared some function, then i type the function in other section. But the android studio doesn't show up the code suggestion or some debugging.
Can Android Studio support Code completion for C/C++ like this:?
Yes it does, as long as the project is setup to use the NDK and the C/CPP sources are included in the project.
Try pulling the ndk sample repo and try opening one of the projects.
If you have a java project and want to edit some arbitrary C or C++ source, then no. It does not have enough information about the source file, include paths, compiler etc...
If your project uses Android.mk to build, it will be a bug of Android Studio. I have been reported.
Android.mk project cannot show code completion for cpp.
It seems that old version of Android Studio does not support code completion of jni native build (with Android.mk as configuration file), and that should already be fixed now.
But if you are using CMake in your project as external building tool and code completion still does not work, It's probably because you have more than one version of cmake installed. You can try to remove extra ones from SDK manager and restart Android Studio, it should work.
To see installed CMake version, you can open the SDK manager and check the 'show package details' on the right bottom. You can view cmake tools installed with different versions.
I have got some open source projects which I want to have a try. But I want to use Eclipse if the project was made using eclipse; otherwise I would like to use Android Studio.
So how can I know by viewing the source code about the IDE used for the development of a particular project? Is there any metadata in any file which stores the IDE information?
I believe that Android Studio sometimes includes gradle related files. That's how I would check.