-
-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while extending the main activity #1662
Comments
I have the same problem. The v7 docs also seem to be incorrect / outdated. |
Here is my webpack.config.js: const webpack = require('@nativescript/webpack')
const { resolve } = require('node:path')
module.exports = env => {
env.appComponents = [
'@nativescript/core/ui/frame',
'@nativescript/core/ui/frame/activity',
resolve(__dirname, 'app/activity.android')
]
webpack.init(env)
// Learn how to customize:
// https://docs.nativescript.org/webpack
const config = webpack.resolveConfig()
config.entry = {
...config.entry,
application: resolve(__dirname, 'app/application.android')
}
return config
}
And there were some type issues with the activity.android.ts code in the docs. Here are the changes I made: public isNativeScriptActivity: boolean = false;
private _callbacks!: AndroidActivityCallbacks;
// I changed `undefined` to `() => {}` here
this._callbacks.onRequestPermissionsResult(this, requestCode, permissions, grantResults, () => {}/*TODO: Enable if needed*/); |
Not sure if you are looking at the latest docs, but this is documented here: |
You're right! It seems like I was looking at old docs after all. I thought I had specifically checked this and clicked to view the latest, but I must have messed it up somehow. |
I am using NS 6.5 Core and I am following the example from https://v6.docs.nativescript.org/core-concepts/android-runtime/advanced-topics/extend-application-activity#extending-activity.
I have cleaned up my project, deleting the platforms, hooks, and node_modules folders. When I build the app, I get the following error: Class "org.myApp.MainActivity" not found.
Here is my code:
activity.android.ts:
webpack.config.js:
AndroidManifest.xml:
Any suggestions on how to proceed?
The text was updated successfully, but these errors were encountered: