Debug native code in Android Studio - android

Google I/O 2015 promised debugging native code in Android Studio. To do this, you need to install ndk-bundle through SDK manager and update Android Studio to the latest version (Canary branch). And what to do next? How setup? Here is a link to the source. Source

Update June 2016: In Android Studio 2.1 the default run configuration supports native debugging so there should be no need to do the below unless you're using an older version.
For older versions:
Here's how to debug native code in Android Studio:
Go to Run->Edit configurations
Click the + sign
Choose 'Android Native' as the configuration type
In the Module dropdown choose your app's module
Add breakpoints to your C/C++ code
Run->Debug...
The app should be deployed and the lldb debugger will attach after ~10s.
Note: When creating the debug configuration under the 'Native Debugger' section you can choose gdb, however this is less well supported than lldb and known to be buggy. Use at your own risk.

Actually, the advertised NDK support isn't available yet, even if you download the ndk-bundle and update Android Studio to the latest version in the canary channel (1.3-preview3 as of now).
The SDK tools team said that the NDK support wasn't part of the first previews of Android Studio 1.3. However it should be out soon - they recently mentioned mid-June as a target.
update: the debugging support is out now. It wasn't the case at the time of the initial question - thanks for all the downvotes since then :) please look at donturner's answer below.

Related

Android Studio in Windows 10 not launch after installing Google Sceneform Tools (Beta)

in windows 10 in Android Studio 3.2.1
the application is worked correctly after first time of installing but after installing Google Sceneform Tools (Beta) from :
File > Settings > Plugins > Browse Repositories
after installing the plugin android studio should restart and then it's can't launch anymore
anyone can help please ?
One cannot just use any version of Google Sceneform Tools ​(Beta)​ with any version of Android Studio. As this one comment suggests, even if it's about other versions (also see the other comments there):
A temporary solution: install Android Studio 3.5.1 + Sceneform 1.5, make sfb file, place in project in Android Studio 3.6.
So in your case, you might probably have to update to Android Studio version 3.5.3 or any other version, which works with the current version 1.16.0, as the Android Studio which you are using appears rather outdated.
If you just want to be able to start Android Studio again, then manually delete the plugin directory from %USERPROFILE%/.AndroidStudio3.2/config/plugins, in order to perform a manual uninstall, as it might be required in order to update Android Studio.
Besides "it's not working" is not an error description. You'd have to start Android Studio from the command line, in order to get some meaningful error message, by which you then could search in the issues on GitHub (if the reason why it doesn't start up anymore might have another cause).
I have had issue #377 filed for this plugin since Oct 16, 2018, and unfortunately it is still open now.
I will update this answer if it is solved or a solution is found.
Update 1 :
the github [repository]2 for this plugin has been archived and it seems no longer supported after reading the documentation here

What is the Last Version of the Eclipse ADT plugin

I have always coded android apps using eclipse as opposed to android studio simply because i find it faster than android studio. However because google has deprecated eclipse as the official IDE for android.They also stopped developing android developer tools (ADT) plugin.
For purposes of the layout renderer in eclipse, I need to know what was the last version of Android Developer Tools plugin for eclipse to be ever released by google before it was deprecated?
The last version of ADT tools should be ADT-23.0.7.
I've never managed to find something newer than that.
In the official annoucement it states:
Android tools inside Eclipse will continue to live on in the open source community via the Eclipse Foundation. Check out the latest Eclipse Andmore project if you are interested in contributing or learning more.

Changing Android build target in Eclipse

I have an Android project in Eclipse that has targeted Android 2.2 for many years but now I want to use some newer features that are only available in later versions of Android, e.g., 4.xx
There is a Stack Overflow question on how to change the build target...
How to change target build on Android project?
. . but my selection in the box on the right that they mention only goes to 3.2. How do I increase my options to newer versions on Android?
Android Studio - the now official IDE for Android development has a handy import feature for making Eclipse projects work.
As CommonsWare above mentioned, it might behoove yourself to make the switch.
It recently hit its 2.1.1 stable release: http://developer.android.com/sdk/index.html
Install Higher version packages , Go to Android SDK Manager-> Select Version-> Install. Keep in mind Eclipse support has been ended, Use Android Studio.
Check Link to know how to install packages- (http://www.wikihow.com/Install-Eclipse-and-Setup-ADT)

How to switch between android source version in Android Studio?

Currently it's not very intuitive how to switch between Android SDK source files in Android Studio while, for example, debugging or just inspecting the sources.
I've got the feeling that Android Studio, unlike IntelliJ, is getting the source's version from the compiled SDK version section of the Gradle configuration. But, this is forcing me to debug on a device which is using the same Android version when debugging. If I don't, then the sources won't be in sync with the debugger.
My question: Is there an easy way to switch between Android sources in Android Studio without having to change the configuration in build.gradle?
Try this:
mv $ANDROID_HOME/sources/android-21 $ANDROID_HOME/sources/android-21-orig
cp $ANDROID_HOME/sources/android-17 $ANDROID_HOME/sources/android-21
Restart android studio so it will pick up the correct paths.
Debug
NodeJS program to easily switch the Android SDK Sources which Android Studio attaches when debugging.
I think studio grabs the Android SDK platform source from the targetSDKVersion.
It's wise to update the targetSDKVersion to the latest Android platform SDK from your SDK manager.
It's better for development if your project constraints you from increasing the targetSDKVersion grab the platform SDK your project mentions.
Android platform SDK's

No Android SDK found - Android Studio

I have a problem with Android 0.4.2 Studio, when creating a new application, it tells me there is a problem with the rendering and shows me the following problem:
Renderering Problems
No Android SDK found. Please configure an Android SDK.
My setup SDK and JDK is this: Android SDK location: C:\adt-bundle-windows\sdk, I put the path I use in Eclipse SDK, or there may be the problem, if someone has happened and what has been fixed, I'd like to give me the solution, thank you very much.
I just encountered and solve a similar problem.
First you should check the directory like other threads described. Then you can check whether the Build tool version matches your SDK version.
(e.g. for my project, in build.gradle file, you have:)
android {
compileSdkVersion 21
buildToolsVersion "21.1.1" }
and then open you SDK manager, make sure you have the same version of sdk(21.1.1) installed in the selected directoriy:
If not, install it and restart Android Studio. It works for me.
I've also seen other guys saying run Android Studio as administrator would also help:
https://teamtreehouse.com/forum/i-am-getting-this-warning-message-rendering-problems-no-android-sdk-found-please-configure-an-android-sdk
I got the same "No Android SDK Found" error message... plus no rendering for Design window, no little cellphone screen.
My SDK path was correct, pointing to where the (downloaded during setup) SDK lives.
During Setup of the SDK Mgr, I didn't download the latest "preview edition (version 20)"...(I thought it better to use the next most recent version (19)) Later I found, there was no dropdown choice in the AVD Manager to pick Version 19, only the default value of the preview, 20.
I thought "Maybe the rendering was based on a version that wasn't present yet." So, I downloaded all the "preview edition's (version 20)" SDK Platform (2) and system images (4)...
Once download/install completed,
RESTARTED Android Studio and Viola! success... error message gone, rendering ok.
From the File menu, choose Project Structure (if you're running 0.4.4 there's a bug and the menu item doesn't have a title, but it still works), and choose the Android SDK item. You should see something like this where you can set up your JDK and SDK.
After setting it, quit Android Studio and relaunch it for good measure.
i have just discovered, android studio 3.0.1 has no sdk during the installation. because during the installation, it doesn't give sdk as part of install able unlike in recent versions of android studio.
Don't worry just change the
build.gradle
ext.kotlin_version = '1.2.41'
to previous version.
It worked for me hope it works for you too.
Happy coding.
According to the Android Studio download page, the SDK comes bundled with Android Studio. It has its own copy when you install Android Studio.
ADT is a plugin for Eclipse. Try reading through that webpage to see if there is something that got missed when installing.
Here is the wording from the site, regarding ADT:
Similar to Eclipse with the ADT Plugin, Android Studio provides integrated Android developer tools for development and debugging.
I wanted to share a part of the issue I had because it is the first google result.
I installed Android Studio, when I tried to install my first SDK from the SDK Management windows I got the error that I didn't have any SDK installed.
I tried to look on the internet to manually download the .zip,manualy create the folder, no luck what so ever.
When I tried to run the Android Studio as an administrator it detected I didn't have any SDK and prompt me right away at startup to download a SDK.
Do following steps
a) Change minSdkVersion and sync gradle
b) Revert back your minSdkVersion and sync gradle again
It will be resolved.
These days, Android Studio setup do not provide SDK as the part of original package.
In the context of windows, when you start Android Studio 1.3.1, you see the error message saying no sdk found. You just have to proceed and provide the path where sdk can be downloaded. And you are done.
Here is the solution just copy your SDK Manager.exe file at the root folder of your android studio's installation, Sync your project and cheers... here is the link for details.
running Android Studio on Windows 7 fails, no Android SDK found
Try make New Project, and then choose same android version that you've installed sdk verions on "Target Android Device" dialog.
In my case, error message gone.
I had the same problem, Android Studio just could not identify the android-sdk folder. All I did was to uninstall and reinstall android studio, and this time it actually identified the folder. Hope it also works out for you.
Download android sdk through this sdk manager https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
(note this link is for mac)
open android studio, click next, open where it ask to add path where u downloaded sdk..... add it... click next, it will downloaad updates..... and it done
Right now, the last version of Android Studio bundled (Windows IDE bundle with SDK (64-bit)) with Android SDK is version 2.3.3:
https://developer.android.com/studio/archive.html#android-studio-2-3-3
which size is about 2GB.
You can use it and then upgrade to the latest version of Android Studio.
I am on Mac Os. In my case, my host file was black. I added following entries (these entries should be there by default, but they weren't).
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
After re-running android studio, it prompted the sdk download.
I fixed this bug changing the proxy configuration:
No proxy → Auto-detect proxy settings

Categories

Resources