Nativescript: Unable to instantiate activity ComponentInfo ... Didn't find class "com.tns.NativeScriptActivity"...

Created on 12 Jun 2017  路  10Comments  路  Source: NativeScript/NativeScript

Did you verify this is a real problem by searching [Stack Overflow]

Same as here: #4152, where the author decided to close his eyes on this problem. I need to fix it.

Tell us about the problem

I'm getting this error on both mobile/emulator with a new project (just created). Tried to install/reinstall everything with no luck.

Which platform(s) does your issue occur on?

Windows 10, Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.0.3
  • Cross-platform modules: 3.0.1
  • Runtime(s): 3.0.1
  • Plugin(s): none

Please tell us how to recreate the issue in as much detail as possible.

npm install -g nativescript@latest
tns create myapp
cd myapp
tns platform add android
tns run android --emulator

Any new project build leads to an error:
screenshot_1
It happens on both emulators (different versions) and hardware device.
I've tried to install/reinstall different versions of Java/SDK/build-tools etc with no luck.

Here is more info about this problem.

current versions of SDK utils:
screenshot_59
screenshot_60

  • Android SDK Build-tools 25.0.3

tns run android --emulator --log trace
log.zip
Errors:

21:10:20.389 [ERROR] [system.err] Note: Some input files use or override a deprecated API.
21:10:20.390 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.

Full app folder (including platforms):
https://drive.google.com/open?id=0B2jyYHLRKuPWZkZvSlRjUVdOWlk

If you need anything else - I'm ready to help.

android question

Most helpful comment

@NickIliev I've finally solved the issue.
The problem was in Gradle. It was installed 3 moths ago.
I've just removed .gradle folder from home directory and when tns build the project it automatically downloads new gradle. And the error gone.

Hope this issue will help someone in the future.

All 10 comments

The message about AssetExtraction will always output that if the app didn't previously exist (it is only a warning and we are considering removing it).

The Some input files use or override a deprecated API. 21:10:20.390 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details. is output by the Gradle build, because we generate classes that use deprecated API considered as of 21 or later. That message will be output regardless if the build succeeds or not, during compilation (again not to worry about)

@trunkovich can you try resetting the emulator you are testing on (with deleted myApp) and then re-building the application.
Also please post your Node and npm version. At this very moment, I am using the exact same environment settings as yours but I am still not able to reproduce it on my side,

@NickIliev

C:\Users\TrUnK>node -v
v6.9.4
C:\Users\TrUnK>npm -v
3.10.7

It happens for a new project as well. So I could just start a new blank project and build it and I will get the error on emulators and my device.

As far as I understand from info on the internet(#4152 and some other issues) it is hard to reproduce this bug. Did you review my project (I've included platform) maybe you will see anything in the build.

Also, I could provide you some access to my PC (teamviewer, for example, or something similar).

@trunkovich yep I have revised your project and it runs on my side as expected.
Can you try using the next Android runtime version as follows

tns create testApp
cd myapp
tns platform remove android
rm -rf node_modules hooks
tns platform add android@next
tns run android --emulator

Or if you don't have rm command in your terminal delete the folders manually

@NickIliev tried on both emulator and device + on both existing project and a new project with no luck.
Same error.

@trunkovich we will need some more time to investigate this - using the generated APK from your platforms folder the issue is reproducible.. but not repeatable with any workflow on our side. I will update the info as soon as we have some additional insight on the matter.

@NickIliev thank you. I will try to reproduce it on same laptop model. Maybe it will give the same result.

@NickIliev I've finally solved the issue.
The problem was in Gradle. It was installed 3 moths ago.
I've just removed .gradle folder from home directory and when tns build the project it automatically downloads new gradle. And the error gone.

Hope this issue will help someone in the future.

@trunkovich happy to hear good news! Thank you for sharing the solution with us and with the community.

I upgrade to android tns-android version: 3.3.1 but i had the graddle downloaded from 2.5.x version. So i had the same error and removing graddle and redownload it helped me.
Thank you!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mspusta78 picture mspusta78  路  59Comments

Dimitrievskislavcho picture Dimitrievskislavcho  路  51Comments

ikhsan017 picture ikhsan017  路  55Comments

dbbk picture dbbk  路  54Comments

danielzzz picture danielzzz  路  59Comments