I am working on building an ionic android application, using gradle ( It is used for a jenkins pipeline, this is the commands I am running :
ionic capacitor add android once I got my android folder, I run this command :
./gradlew assembleRelease).
The issue I am facing is related to security stuff. Inside the common.js file. I am having these variables exposed, and according to the security team, I am having a vulnerability called "INTERNAL PATH DISCLOSURE" (which refers to this line:
/* harmony import / var home_ubuntu_repos_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0_= webpack_require(/! ./node_modules/#babel/runtime/helpers/esm/asyncToGenerator.js */1670);
)
I am wondering, if there is a way, to build my app, and create this common.js file, without the internal path.
Thanks in advance.
Related
I have an app made in Ionic5 framework with the support of Angular, when I run ionic serve --lab, the android app works without problem but the problem is that when I export the project to Android Studio with (ionic capacitor copy android) and I run the app on my device suddenly crashes and stops.
I have been looking for information but I have not found any useful data. My question is more generic than this platform is used to. What error detecting techniques I should use (Android Studio, npm vulnerabilities) and what are some typical cases that generate this error?
I let some posible useful project data:
I use Firebase for database and back-end services.
NPM warn me due to the fact that I have 10 vulnerabilities.
Ther could be a number of reasons for this.
Try running opening chrome://inspect/#devices where you can select your device and see all console logs.
Also try syncing your gradle files in android studio
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:
I'am trying to integrate React Native to my existing Android app using the newest React Native version of 0.45.1.
The project setup is standard as created by the init command. In the android subfolder I checked out my existing Android app and followed the steps from Integration With Existing Apps
When running react-native run-android its gets me:
ENOENT: no such file or directory, open 'app/src/main/AndroidManifest.xml'
This is obviously due to my non standard Android project structure as I have several modules and my main module is not named app.
Now the actual question: Is there a way to configure the React Native layer and to tell it where my Manifest and possibly other required files reside?
Got is, pretty simple actually. --help is your friend.
--appFolder [string] Specify a different application folder name for the android source.
is exactly what I was looking for. For anyone who has similar troubles, there are some other interesting options as well.
I have created an Angular 2 application and I'm looking for creating an Android application with Apache Cordova. When I load the application in a Marshmallow emulator, the application does not load any of the declared resources. If I use the browser plugin it works as expected. Using Chrome to inspect the device's console reveals the following output.
Chrome console output:
If I run the Cordova initial sample it works in the same Android emulator so it has to be a problem with the sources. The code can be checked in the Github repository. The application is in the www directory, for testing it is necessary to add the android platform.
$ cordova platform add android
$ cordova run android
I can not found an answer for this problem:
The resources looks fine - discard file path issues.
The browser plugin works (Chrome) - discard application errors and security policies.
The cordova sample works as expected for Android - discard environment errors.
Please, does anyone knows what is the problem with this setup?
I have found the root cause. The problem is that by using the angular-cli tool, the tag <base href="/"> is being added automatically. According to the tag documentation, it serves a base to resolve all the document's relative URLs.
For this use case, removing the base tag or configuring it to a valid value like <base href="/android_asset/www/"> fixes the problems. As I do not use routing features (yet) I feel more confortable removing it or setting a value like <base href="."/> that it's suitable for more platforms builds.
Have you tried modifying Content-Security-Policy?
Or how about modifying 'allow-intent' in config.xml?
When I was having resources issue, these were helping.
I am developing a hybrid app for android using Angular JS and cordova.
For build deployment, our organization is using Jenkins.
Now my issue is that through jenkins, I am building only the Android project folder inside the cordova project to generate the APK file.
I want to generate APK for different environemnts like Stage,Dev and Production by just changing a single property file.
How could the cordova+Angular project read the environment specific informations from a common file in Jenkins,also how to switch between different
build enviromnments in Jenkins.
Could anyone suggest the thoughts .I am still confused in finding a solution for this.
Thanks in advance