Closed RadouaneRoufid closed 6 years ago
Hey @RadouaneRoufid,
I've tried to reproduce this issue with my android-extend-ng sample app, but to no avail. Are you able to replicate the problem with this project at your end?
Hi @vchimev
I changed resolve(__dirname, "app/activity.android.ts")
, to "./activity.android.ts"
in my webpack.config.js and build is done correctly now with a warning.
Warning: there already is an extend called org.myApp.MainActivity.
Warning: The static binding generator will generate extend from:bundle.js implementation
I'm using nativescript-dev-webpack 0.12.0
. I will migrate to 0.13.0
as in android-extend-ng
.
Thank you for your reactivity !
I have a little question @vchimev. I need to import my custoMActivity in my app.component. The problem is in dev mode, I need to import from import {whatever} from "./activity.android";
and in bundle mode // import {whatever} from "./activity";
How can i handle this scenario ?
Hey @RadouaneRoufid,
Let me follow up that adding a custom android app component to the array on the top of the webpack.config.js file should be resolved to an absolute path, i.e.
resolve(__dirname, "app/activity.android.ts")
in order to be included in the common vendor.js chunk. Adding it by a relative path is only a workaround for this issue on Windows, which fix is on a pull request.
In regard to the original problem with build failed, you reported, I updated all the demos in the branch for the fix above to extend android activity and application, and managed to execute them successfully, not reproducing the problem.
Do you still experience it?
I'm still using "nativescript-dev-webpack": "^0.12.0"
which requires a relative path to activity.android.ts on linux platform.
const appComponents = [
"tns-core-modules/ui/frame",
"tns-core-modules/ui/frame/activity",
"./activity.android.ts",
];
Issue Checklist
Tell us about the problem
I'm using a custom android activity in my nativescript project.
I declared this activity in my AndroidManifest.xml as below
I added this activity in webpack.config.js
Building with:
tns build android --bundle --env.aot --env.uglify --env.snapshot
results with the following error:Local environment
Project data
const webpack = require("webpack"); const nsWebpack = require("nativescript-dev-webpack"); const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); const CleanWebpackPlugin = require("clean-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
module.exports = env => { // Add your custom Activities, Services and other Android app components here. const appComponents = [ "tns-core-modules/ui/frame", "tns-core-modules/ui/frame/activity", resolve(__dirname, "app/activity.android.ts"), ];
};