Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Conversation

Plamen5kov
Copy link
Contributor

@Plamen5kov Plamen5kov commented Dec 4, 2017

After 3.4.0 release, we have Integration with Android Studio.
That means users will be able to debug their application with any nativescript android runtime ^3.4.0.
This is the documentation explaining how can an application be debugged with the runtime.

Kept the structure close to the iOS docs.

@Plamen5kov Plamen5kov force-pushed the plamen5kov/add-debug-runtime-docs branch from 9f9cd07 to 52795f3 Compare December 4, 2017 14:13
@Plamen5kov Plamen5kov force-pushed the plamen5kov/add-debug-runtime-docs branch from 52795f3 to 6632d9f Compare December 4, 2017 14:51
@Plamen5kov Plamen5kov force-pushed the plamen5kov/add-debug-runtime-docs branch from 06d052a to 716f249 Compare December 4, 2017 15:07
@Plamen5kov Plamen5kov self-assigned this Dec 4, 2017
Copy link
Contributor

@petekanev petekanev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on the article. I left a couple of comments on grammar and wording.


# Debugging the Android Runtime within your app's Android Studio project

## What is this document about?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename the header to a more generic one like 'Overview', or maybe even Debugging the Runtime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took the name from the iOS article, and tried and keep it as close to it as possible, hence the name


## What is this document about?

In certain scenarios where runtime errors occur, the debug info provided by the NativeScript CLI are not sufficient. This article will guide you through the steps needed to debug the Android Runtime library module as a part of your NativeScript application. It implies you have the [android-runtime repository](https://github.com/NativeScript/android-runtime) already cloned and set up. For more info on how to setup the android-runtime project on your machine refer to its [README](https://github.com/NativeScript/android-runtime/blob/master/README.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'the debug info is not sufficient.'

'It implies you have already cloned and setup the ...'

...on how to setup the android-runtime project on your workstation, refer to the repository README ...


## Creating the sample application

### 1. Create a new NativeScript application using one of the following commands depending on your platform preference:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... commands depending on your language/technology preference:


`tns prepare android`

> After you have prepared the project, make sure the `tns-android` version is at least 3.4.0, because that's the version the Android Studio support is introduced. You can check the version by running `tns info` inside the project folder.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the beginning of the subsection and maybe start with 'Before preparing the project, make sure...'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The users can't make sure the installed tns-android version, before actually adding it, by running prepare or platform add. That's why I've put the note after the commands.

### 3. Open the Android Studio project:

* Open Android Studio
* `File/Open` or `Open an existing Android Studio project`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click File -> Open or Open an existing Android Studio project


### 1. Make sure you have NDK and SDK directories set, because it's needed to build the Android runtime.

* `File/Project Structure`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click File -> Project Structure

### 1. Make sure you have NDK and SDK directories set, because it's needed to build the Android runtime.

* `File/Project Structure`
* SDK Location
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigate to/Select the SDK Location section

* SDK Location
* Check if Android NDK and SDK Location is set

After set up the Project Structure should look like this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the setup, the Project Structure dialog/window should look like this:

Copy link
Contributor

@petekanev petekanev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple more suggestions how the article can be improved.

I also think you could include references to this article in https://docs.nativescript.org/tooling/debugging's See also section

![Settings Gradle Before](settings-gradle-before.png)

* Uncomment the included projects: `:runtime` and `:runtime-binding-generator`
* Uncomment and set the `:runtime` and `:runtime-binding-generator` project dirs. These project dirs, can be found in the already cloned [android-runtime repository](https://github.com/NativeScript/android-runtime).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the already cloned remark sounds like an unnecessary addition, considering the user is that deep into setting up their project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer being specific rather than misunderstood.


![Settings Gradle After](settings-gradle-after.png)

After the files are synced you should see the `:runtime` and `:runtime-binding-generator` modules in Android Studio and should look like this:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the sync has completed, the ... and ... modules should appear in the Project view in Android Studio:


## Debug the Android Runtime

### 1. How to debug the Java part of the runtime
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Debugging the runtime Java code'


![Run In Debug](hit-debug.png)

> When you run the project in debug, you should see in the `Gradle Console`(bottom right) the Android Runtime being built.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you run the project in debug, you should see the Android Runtime build log in the Gradle Console(bottom right).


## Known Issues

If you have native plugins in your application, you will still be able to build it with Android Studio, but you won't be able to debug it with the Android runtime. We will fix that issue in the upcoming releases.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

native plugins in the sense of c++ or Android Libraries? Since we are introducing the subject of debugging c++ code, we don't want to confuse the enthusiastic developers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true that, will rephrase

@Plamen5kov Plamen5kov merged commit 387622e into master Dec 18, 2017
@Plamen5kov Plamen5kov deleted the plamen5kov/add-debug-runtime-docs branch December 18, 2017 15:33
@lock
Copy link

lock bot commented Aug 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants