Cannot find namespace 'android'


I am trying to extend the Android activity class to provide onNewIntent handling. I’ve created a new activity and referenced it in the AndroidManifest.xml. When compiling I get a number of errors similar to:

class MainActivity extends {
app/native/,28): error TS2304: Cannot find name 'android'.
protected onCreate(savedInstanceState: android.os.Bundle): void {
app/native/,42): error TS2503: Cannot find namespace 'android'.

I’ve followed instructions for tns-platform-declarations with no luck.
I’ve also copied my activity and AndroidManifest.xml file changes into a clone of nativescript-sdk-examples-ng and the types are recognized and compilation works.

Project details:

  • tns --version: 3.1.2
  • tns-android: 3.1.1
  • tns-ios: 3.1.0
  • tns-core-modules: 3.1.0
  • tns-platform-declarations: 3.1.0
  • angular: 4.1.0
  • typescript: 2.3.4


/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />


  "compilerOptions": {
    "noEmitOnError": false,
    "noEmitHelpers": true,
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "noImplicitAny": false,
    "noImplicitUseStrict": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "pretty": true,
    "skipLibCheck": true,
    "lib": [
    "baseUrl": ".",
    "paths": {
      "app/*": [
      "~/app/*": [
      "*": [
  "include": [
  "exclude": [

Our project is using the angular-native-seed.


Resolved. The seed project has a gulp task that copies assets from src/ to the NativeScript recognized app/ directory. The references.d.ts file was at the same level as src/ and not getting copied over to app/. Moving the references file inside src/ got it to copy over the tsc isn’t erroring anymore.