How to setup custom settings.gradle at Android Studio? - android-studio

I need to build a project in Android Studio using second settings gradle file (for sample settings-lite.gradle). How to do that? Andriod Studio version is 2021.2.1.
PS: I don't need to build the project by CLI.

Related

How i can build old Android project in Android Studio

i have to build this project but getting error because it is so old.
here is the project git hub link
i am using latest android studio version
Try the following:
Change gradle version in build.gradle , change the version in the following line in the file: classpath 'com.android.tools.build:gradle:2.2.3'.
In the file gradle/wrapper/gradle-wrapper.properties, update the gradle version in this line: distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip . Sync the project again, it should work. If it doesn't restart android studio again. It should build successfully afterward.
PS: See what gradle version you use according to your android studio version.

PanoramaGL library for android studio

I have a developed app using PanoramaGL library from this link. But it is for Eclipse and I want it for Android Studio because the eclipse project is building successfully in Android Studio but it is not running. Please help me..
Did you include the library in your build.gradle file ?
There is no difference between Libraries in Eclipse and Android Studio. Just be aware that Android Studio uses Gradle as its build system.
dependencies {
compile files('libs/PanoramaGL_0.2-beta.jar')
...
}

Open cocos2d-x-3.7 in Android Studio

What is the proper way to open cocos2d-x-3.7 in Android Studio?
I tried:
Open existing project in Android Studio project > Choose proj.android-studio directory (In another attempt, I also tried to choose the base directory MyGame)
Run
Error: couldn't find "libcocos2dcpp.so.
Moreover, it also does Classes directory in the Project.
Android Studio is only partially supported in cocos2d-x 3.7 and 3.8. With the default project you will only be able to run your app without debugging using Android Studio.
Prior to running your app in Android Studio you will have to compile using the Android Studio flag:
cocos compile -p android --android-studio
You will have to run this command after any changes to your app are made, since the default Android Studio currently doesn't compile your project.
Furthermore the default Android Studio project does not include the Classes directory.
Suggestion: Use Eclipse or Xcode to develop your cocos2d-x projects for now. Hopefully future versions of cocos2d-x will have better support for Android Studio out of the box, this is critical considering Google is dropping support for Eclipse.
When you try to run the application on Android Studio, you get the error couldn't find "libcocos2dcpp.so" because it doesn't have the NDK for building your game.
I recommend you to compile proj.android and import that, cocos2d-x 3.7 doesn't support full Android Studio yet. Do this:
cocos compile -p android
Then import your proj.android to Android Studio.
Now you can run your application but you won't able to debug it, bad news (it will just install the APK on your device or virtual device).
Hope it helps.
Error: couldn't find "libcocos2dcpp.so.
For this you need to compile android studio project first so .so files and classes folder will be generated.
Open your command line and enter the following command to compile your android studio project:
cocos compile -p android --android-studio --ap android-24 --app-abi x86
This will create required files in your proj.android-studio directory.
Now import this project into Android Studio and try to run it.

How do I disable the NDK build in Android Studio 1.0.1

I am trying to build an Android Java app using Android Studio 1.0.1. However, my app uses some C++ code that I build using the NDK as controlled by Android.mk and Application.mk files. But Android Studio tries its own build and gets it wrong as it is not using my *.mk files. I know there have been some answers how to do this for previous versions of Android Studio but they evidently do not work for 1.0.1.
So how do I disable Android NDK builds in Android Studio 1.0.1?
Just add the sourceSets.main.jni.srcDirs = [] to 'android' section of your build.gradle. This will disable automatic call of ndk-build with auto-generated Android.mk.
And yes, this line should be added to the project-specific gradle file.

Migrate project to Gradle

I've got a project that used to be in Eclipse. I've since moved it from there into Android Studio, though it's not using the Gradle build system yet.
I've setup my gradle files so that I can do gradlew build from the command-line and it will generate an APK for me.
My question now is how do I get Android studio to build using the gradle files that I've got setup instead of the using the "old" way?
For what it's worth, I'm on Windows 7.
Not sure how you are compiling the project with Android Studio without actually using Gradle because AFAIK Android Studio always uses Gradle under the hoods to build sources.
Anyway, if you have your Gradle config file ready you only have to import it to a new project in Android Studio (File > Import Project... and then select the build.gradle or settings.gradle)

Resources