I'm quite new to NativeScript. Currently, one of my projects is using NativeScript to develop cross-platform app. It has a 3rd-party lib which is written in java. But the result is not as good as I expected. I was struggling to find the problem since the console didn't log valuable info regarding to native code.
Instead, I import the project to Android Studio which is under the folder of platform/android. But it logs error when I hit the "run" button.
I want to know:
Is it possible to debug native code directly with VS Code. At least print out java native error or cat log.
How can I debug native code in Android Studio? How to solve the problem I ran into?
I'd be very appreciated, if anyone can answer my questions. Thanks!
Let me start off by saying there's no official integration with Android Studio. All I can provide is a workaround that will make it possible.
Note: The steps provided below are tested with NativeScript CLI 3.1.1 and will probably work also with 3.2.0.
The first problem is you don't have "node" set in your global path so first of all, you need to add it to PATH. Node required for NativeScript to run. You can look at how to set it up here
If you want to be able to run the project with Android Studio you can follow these steps:
After you've done that you need to change the <app_name>/platforms/android/build.gradle file as described here
The above change will enable you to open <app_name>/platforms/android in Android Studio
Run <app_name>:clean task from gradle
Run the task default for Android Studio, that will prompt you for emulator or device on which to run:
Related
I expect the answer is 'no' from what I've already found, but thought I'd ask the specific question.
I have a Flutter app which via a channel calls into an android plugin the java source for which is in the app source tree. Since one can also do java development in VS Code, I thought there might be a way to step into the plugin code while debugging the Flutter app, but so far no luck - the app doesn't "see" that the source for the plugin it's using is open in a VSC editor. Is there a way to configure for this? I've already installed the Java coding support extensions for VSC.
I like VSC because it's so lightweight, but if I have to use Android Studio to be able to code & debug both flutter and java plugin code in the same app that's fine. In which case how to configure for that?
Thanks!
I'm getting red letters in my AndroidManifest.xml and don't understand what they mean. At the moment everything seems to be working as should. But will I get any problems down the road?
Nope, Android Studio can't understand the Android content when a Flutter project is opened.
It can either understand the Flutter directory structure when Flutter is opened. This is what enables Code Completion and other nice features when making Flutter apps.
If it's a simple Android project, then it can easily understand the Gradle files and your Java/Kotlin.
What this means for you as a Flutter developer is that, when you are editing native Android or iOS code. You will not get code completion. Android Studio will not be able to tell you about the errors in your code.
The Flutter team is working on this. So that you can have all the cool IntelliJ features for editing Native code EVEN when you have a Flutter project is opened.
Also, I think if you open the android separately, then you should be able to see properly. (Maybe, I'm not sure).
You can now open the Android part of your Flutter project by right clicking on the project name in the project window, choose Flutter and then Open Android module in Android Studio.
The opened Android project will have code completion and all the red letters will most likely turn other colors :)
I have those three files:
activity_main.xml
MainActivity.java
AndroidManifest.xml
Those belong to a webview app I found on google...
I want to convert those files into an android apk....
I have no ides at all, just my basic laptop (doesnt support android studio) with internet conection. How can I make that work?
First you need to install Google's Android Studio. Go to
https://developer.android.com/studio
and then follow the installation instructions. Do not be surprised if this takes some time! Android Studio is BIG when you have installed the necessary SDKs and perhaps an emulator. Android Studio includes a lot of useful help.
From command line is posible with
gradlew assembleDebug
https://developer.android.com/studio/build/building-cmdline
I am trying to create a SDK on android with ionic, when i try i write
ionic cordova build android
but it does't work because when i search the SDK i don't find it, i don't know what to do, it is the first time that i use ionic and i don't know how to install the app on the phone,the app is ready to be used,to try the app i used the emulator with "ionic serve --lab" please help me
This is an image of what prompt does:
You may need to download gradle for building an android app. This answer is more proper as comment but I don't have enough reputations. So, I leave anwser.
Read the link below
ionic 2 - Error Could not find an installed version of Gradle either in Android Studio
p.s. My original answer is a mistake.
I found a few questions asking how to get the source code from the AOSP running in Android Studio. However, I could not find any explanation on how to import only a single application of the AOSP.
I am trying to do it for the Dialer application which can be found here. However, I had only minor success, I was able to import the code as a project, but didn't manage to set up dependencies and required libraries and all that.
Can anybody tell me if it is possible, and if so, how this is done?
UPDATE:
It seems impossible to achieve this with the code that i found and which was part of the full android distribution of google. But google decided to distribute the Dialer application just like any other application via the playStore. So there should be a possibility to find this code, IF it is also running under the open source project.
You can only open the whole AOSP inside Android Studio.
After you finish building the source do make idegen && development/tools/idegen/idegen.sh inside your root folder and then open the new android.ipr in your root via Android Studio.
AOSP code you are looking is not Android Studio compatible, It's an Eclipse project.