Android Studio: can't choose python interpreter with python plugin - android-studio

I'm running Android Studio 2.3 with the "Pycharm community edition" plugin to allow the code highlighting, linting, and running etc of .py files that happen to be in my Android Studio project folder.
(To be clear, the python scripts only ever runs locally on my machine and I'm certainly not expecting to run any python code on Android. The .py files are utility scripts that just happen to be in the same working directory as the rest of the Android project).
However, when I go to edit configurations I'm unable to select an interpreter that already exists on my machine (The only option is "Project Default"). In IntelliJ (which Android Studio is based off-of) one can go to Project Structure > Add, and add a python SDK.
In Android Studio, going to Project Structure > Add only gives me a choice between Android related modules. How am I supposed to chose my python interpreter with the Android Studio python plugin? Is this a bug? Without getting to chose the interpreter, the code highlighting says it can't find basic modules like "import os" or "import math". Has anyone had any success with this?

Related

How can I use gradle installed in WSL alongside Android Studio installed on Windows

I've recently had to start developing a Micronaut project in Android Studio instead of IntelliJ IDEA Ultimate. I'd assumed that because they share the same base this would be fine but when I load up my project I get this (the project is held in the wsl filesystem and all development has been using WSL with IDEA):
14:07 Project [name] is using the following JDK location when running Gradle:
//wsl$/Ubuntu-22.04/usr/lib/jvm/java-11-openjdk-amd64
Using different JDK locations on different processes might cause Gradle to
spawn multiple daemons, for example, by executing Gradle tasks from a terminal
while using Android Studio.
More info...
Select a JDK
Do not show this warning again
It's unclear why this is happening, when I click 'Select a JDK', what is selected is the JDK installed on WSL that IntelliJ is using, likewise it is pointed at the same directory where my gradle properties is kept.
I'm not sure where to go with this, my guess would be maybe Android Studio is trying to run a gradle or java instance that's not the WSL one (I think it installs it's own alongside) and that's the issue but the settings would imply otherwise. Does anyone know what might be happening?
Thanks!

Android Studio C++ Support Missing

I just installed Android Studio 3.6.3 on Windows 10 and I created a new Native C++ project. I can build and run the native project and I can debug Java code in the project.
The problems I'm having are:
I can't step into the C++ code when debugging
I can't set breakpoints in *.cpp files.
When I right click folders in the project view to add a new file, I only see options to add Java, Kotlin, and Android platform files. There aren't any options to add C++ source or header files.
When I open a C++ file Android Studio recommends installing plugins supporting *.cpp. The plugin it's recommending is for Arma 3 plugin development.
The "Attach Debugger To Process" menu only has Java as a debugger option. That list should also contain Native, Dual, and Auto.
I've made sure to install CMake and NDK (Side By Side) in the SDK Manager and I've configured the NDK in the project settings. I've tried reinstalling Android Studio 3.6.3 and I've also downloaded Android Studio 4.0 RC 1, but I have the same problems.
What steps am I missing to get C++ support in Android Studio?
Managed to get it working. Turns out just running the uninstaller wasn't enough, I had to follow the steps in this answer to completely uninstall Android Studio. I then reinstalled and everything seems to be good.

How to use the kotlin compiler in command line which comes with Android Studio?

I have Android studio version 3.4.1. I am able to build Android apps with the Kotlin language. I have heard that we can use Kotlin for creating standalone programs other than building android apps.
So, I want to know how to run the Kotlin compiler of Android studio to compile and run Kotlin programs in the command line, without downloading anything else?. I am using Windows 10 Pro.
I'm on Lubuntu 16.04 LTS, not Windows. But maybe this can still help you.
In my Lubuntu, Android Studio put the Kotlin compiler in directory
$HOME/.AndroidStudio3.4/config/plugins/Kotlin/kotlinc/bin .
So on Windows, make your file manager show hidden files and directories - because on Lubuntu, the "." in ".AndroidStudio3.4" means "hidden".
Go to your home or user directory and find a directory named "AndroidStudio3.4" or similar. Then just follow the path given above.
On Lubuntu, kotlinc (the compiler) isn't executable. If it's the same on Windows, give it execution permission.
I can't imagine that giving this permission affects how Kotlin works in Android Studio. But if you want to be on the safe side, install a separate command line compiler or IntelliJ.
By the way, the Kotlin 1.3.40 REPL crashes (s. issue KT-32085). If you need it, use Kotlin 1.3.31 .

where is the Android Studio executable

Where is the Android Studio executable file stored in the system?
I have it installed, but have unpinned it from the taskbar, which was the only shortcut I had. Since I can't find it in File Explorer, I can't load it.
I've tried the Start menu search function, and used File Explorer to search the entire install directory. The only thing left I can think of to do is reinstall it, but I don't really want to do that, as it was working fine.
P.S. I wasn't sure if this was more appropriate for SuperUser, since it's not directly coding related, or SO, since I doubt the number of people on SuperUser with the answer.
You can find the executable file in bin folder where the android studio is installed, default location is
Windows
C:\Program Files\Android\Android Studio\bin\studio.exe
There is also studio64.exe in the same directory for 64-bit machines
Linux
path_to\android-studio\bin\studio.sh
In Ubuntu/Gnome make sure you create an application file in
/usr/share/applications/android-studio.desktop
with the following content
[Desktop Entry]
Name=AndroidStudio
Type=Application
Exec=/path/to/android-studio/bin/studio.sh
Terminal=false
Icon=/path/to/android-studio/bin/studio.png
Comment=Android Studio
NoDisplay=false
Categories=Development;IDE;
Name[en]=AndroidStudio
This way you will be able to find Android Studio in the applications list, create desktop shortcuts for Android Studio or add it to the favourites bar.
I don't remember how did I installed Android Studio on my Ubuntu 16.04, but my android studio executable is located as /snap/bin/android-studio.

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.

Resources