-
-
Notifications
You must be signed in to change notification settings - Fork 197
Cannot read property "targetNum" of undefined #2034
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
Comments
From @Pip3r4o on August 10, 2016 19:23 @vchittar we released NativeScript 2.2 today, so I strongly suggest you do a Additionally I'd suggest that you update your android SDK if you haven't done that already. And finally if neither of the above helps - you could manually invoke the gradle build with an additional flag to get a more detailed output of the error. cd platforms/android
./gradlew buildapk --stacktrace |
From @NathanaelA on August 10, 2016 19:31 @vchittar See my blog post on this subject; but I would agree with @Pip3r4o to upgrade your android tools... |
From @vchittar on August 10, 2016 19:34 Yeah I tried all of that and didn't work. This is the stacktrace output.
|
From @NathanaelA on August 10, 2016 20:41 Here is the key factor: |
From @vchittar on August 10, 2016 20:54 Yeah i installed the build version earlier but it still gives me the same error. |
From @NathanaelA on August 10, 2016 21:43 You need that EXACT version installed; you can't use a earlier or LATER version. It specifically checks for that version... Either your ANDROID_HOME is not set properly or you do not have that specific version of the Build tools installed. |
From @vchittar on August 11, 2016 15:25 /usr/local/Cellar/android-sdk/24.4.1_1/ This is my android home directory currently. I installed this version when I first installed NS. |
From @vchittar on August 11, 2016 15:57 I have all of the installed and the path seems to be correct, but I still cant figure out why it doesnt work. EDIT: Now I get this new error Cannot read property 'targetNum' of undefined |
Hi @vchittar
You can also just paste them in a terminal and try building again, running the command in the same terminal. |
From @vchittar on August 13, 2016 18:15 @Plamen5kov hey, that didnt work. It still keeps saying process failed for some reason even when I put in all these in the .profile file. |
@vchittar can you post the fail message you're getting? |
From @vekexasia on August 14, 2016 16:49
|
From @vchittar on August 14, 2016 20:18 This is my error:
|
@vchittar can you run the command:
and post the result back here. Also could you post the results of the commands:
|
From @vekexasia on August 15, 2016 10:23 @Plamen5kov do you think mine is related? |
Hi @vekexasia,
So we can figure out what's wrong. Please give a ling to paste bin. @vekexasia what cli version are you using? You might need to update your build and platform tools from the android sdk manager. |
From @vchittar on August 15, 2016 18:26 http://pastebin.com/edkZDR4x (This is the gradlew --debug command) http://pastebin.com/ZQzqvciR (first ls -la command) http://pastebin.com/eQv4MpU2 (second ls -la command) |
Hi @vchittar,
And make sure you have the correct access rights, when you try and execute a command. EDIT:
It complains about |
From @vchittar on August 16, 2016 13:32 Hey thanks for all the help, but I checked my .profile and corrected it a little bit and I still cant run tns run android for some reason. The error I get is : "Cannot read property 'toString' of undefined" Thank you for being so patient with me and helping me solve my problems. EDIT: I edited ~/.profile and ~/bash_profile so it would point to the correct Android Home directory and it still doesnt work. |
@vchittar please link the whole error log. |
From @vchittar on August 16, 2016 14:38
Thats the whole error even with the debug flag. |
Could you run |
From @vchittar on August 16, 2016 14:43
Sorry I forgot about the log trace command. EDIT: I put the export commands in my terminal and that doesnt seem to work and I get the type undefined error, so do i need to put the export commands in my .bash_profile or .profile or .bashrc? |
It all leads to your sdk not being installed/set up properly
If those paths are set up properly, the following commands should run: |
From @vchittar on August 16, 2016 22:25 which adb results in /usr/local/bin/adb which android results in /usr/local/bin/android and both adb --help and android --help work. |
@vchittar that's not normal installation of the android-sdk. I would suggest removing it and installing it manually. And setting up the path variables after the manual installation.
|
Well no, that depends on how you installed it in the first place. If you installed it using the package manager you should use the package manager to remove it. Otherwise there might be files left behind like:
|
From @vchittar on August 16, 2016 23:20 echo $ANDROID_HOME gives me "~/tools/android-sdk-linux" but which android doesnt, do you know why? EDIT: I fixed that, and now it says "adb from the Android SDK is not installed or is not configured properly" |
Please follow these steps here. EDIT: I'm closing this issue because it's related to setting up the environment, rather than a problem with the runtime itself. |
From @jetsgit on September 6, 2016 18:7 I am getting same error as @vchittar with Error: Cannot read property 'targetNum' of undefined I have run both adb --help and android --help work. Environment vars:
This isn't exactly what @Plamen5kov mentioned, but seems this should not be a problem if everything is being found correctly. It is where the script installed everything.
The location of installation is where the script at link @Plamen5kov provided installed android-sdk. I did notice in my installation that:
My samples directory is empty. I have not been able to figure out how to populate with samples using the android-sdk tool. Reading online documentation showed there was a way to do that in the past, |
Hi @jetsgit |
What went wrong:
But why do I still get this error? I dont understand. I have tried it on several different computers and yet I still get the same error. |
@vchittar this error indicatest that there's some incorrect resource in your project. For example in case you have invalid
Do you reproduce the issue with these commands? |
I followed all these steps but nothing really worked. Make sure you have a device on AVD manager. as shown here http://stackoverflow.com/questions/39361369/cannot-read-property-targetnum-of-undefined/39364308#39364308 . |
@rosen-vladimirov , thanks for advice---that was the problem. Also, just a heads-up for folks using genymotion. If you are getting an: error: could not install smartsocket listener: Address already in use You need to set path to This link details it all: http://stackoverflow.com/questions/35959350/react-native-android-genymotion-adb-server-didnt-ack |
FAILURE: Build failed with an exception.
BUILD FAILED Total time: 29.103 secs Now I am facing this error? I dont understand why everytime I run it, I get a new error. Anyone got a solution? |
From @vchittar on August 10, 2016 17:5
Whenever I try to build or run an android project I usually run into this problem.
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':processF0F1F2F3F4F5DebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
Does anyone know why this problem occurs? I have been trying for a very long time to fix this and I cannot figure out how to do so.
Thanks!
Copied from original issue: NativeScript/android#533
The text was updated successfully, but these errors were encountered: