Thank you for the answer, -c option works fine!
The next question is, what I should put in settings.gradle to build a project?
I created a simple project called TegraGradle and tried to include it in different ways, but always got the following error message:
FAILURE: Build failed with an exception.
[ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
[ERROR] [org.gradle.BuildExceptionReporter] No projects in this build have build file ‘C:\Work\Samples\TegraGradle\Tegra-Android\Debug\build\nsight_tegra_build.gradle’.
[ERROR] [org.gradle.BuildExceptionReporter]
hi deko,
please check the content of your gradle.settings, seems it is incorrect.
I suggest you could take a verified sample to test the -c option in nsight tegra.
You are right settings.gradle is incorrect now, as I try to make it from scratch.
Where can I find a “verified sample” to take a look at settings.gradle? The ordinary sample is created without this file.
hi deko,
I am testing to use settings.gradle to build the multi-modules project. unfortunately it’s failed when I build. anyway I will post my test details for discussion.
my test project structure is:
Android 13
|
|–jni
|–libs
| |–com
| |–test
| |–samplelib
| |–SampleLib.java
|–res
|–src
| |–com
| |–example
| |–hellojni
| |–HelloJni.java --------> import com.test.samplelib.SampleLib
|–AndroidManifest.xml
|–nsight_tegra_build_overrides.gradle ------->the same function as build.gradle
|–settings.gradle ----------> content is: include ‘:libs’
that will fail due to:
1> * What went wrong:
1> A problem occurred evaluating settings ‘Android13’.
1> > Could not find method ?include() for arguments [:libs] on settings ‘Android13’ of type org.gradle.initialization.DefaultSettings.
Thank you for investigating further!
Googling No projects in this build have build file, I found the archive topic.
Here is the example from there:
gradle -c ../settings.gradle -b build2.gradle ear
What went wrong:
Could not select the default project for this build. No projects in this build have build file ‘build2.gradle’.
And the comment on the issue:
‘-b’ only works for single-project builds, but apparently you have a multi-project build. In that case, only ‘settings.gradle’ decides which build scripts are used, and conditionally using either ‘build.gradle’ or ‘build2.gradle’ is not a recommended approach.
In my example Tegra uses the following command line to execute Gradle:
I found a workaround.
I added my_lib sources in Java Source Directories settings section and it works.
Yes, I can’t still use the same Android Studio project in Tegra, but I can share the same sources, and that’s fine.