Skip to content
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

Build continues after gradle build fails #2639

Closed
petekanev opened this issue Mar 23, 2017 · 7 comments
Closed

Build continues after gradle build fails #2639

petekanev opened this issue Mar 23, 2017 · 7 comments
Assignees
Milestone

Comments

@petekanev
Copy link
Contributor

Problem:

If the gradle build fails, the CLI will continue executing, printing Project successfully built. Installing..., and will attempt to adb push an APK.

What this means is that if there is an APK available and a consecutive build fails, the older APK will be used, and the user may never learn that their build didn't complete successfully.

Versions:

CLI: @next
Android runtime: @next (3.0)
modules: any version

Steps to reproduce:

tns create crashMe
cd crashMe
tns platform add android@next

tns build/run android
tns plugin remove tns-core-modules
tns plugin add tns-core-modules@internal-preview
tns run android

OR

make changes to the 'build.gradle' in a task's execution phase to force an exception
tns run android

The run will output the following:
It becomes evident that the gradle build failed during asbg:generateBindings, and the output of the process is 'BUILD FAILED'. Despite that the build continues and deploys on device (provided there was an APK available previously)

$ tns run android
Searching for devices...
iTunes is not installed. Install it on your system and run this command again.
Skipping prepare.
Building project...
> Configuring > 0/3 projects > root project
:config phase:  createDefaultIncludeFiles
        +found plugins: tns-core-modules-widgets

:config phase:  createPluginsConfigFile
         Creating product flavors include.gradle file in D:\work\projects\crashMe\platforms\android/configurations folder...

:config phase:  pluginExtend
        +applying configuration from: D:\work\projects\crashMe\platforms\android\configurations\include.gradle
        +applying configuration from: D:\work\projects\crashMe\platforms\android\configurations\tns-core-modules-widgets\include.gradle

:config phase:  copyAarDependencies
> Configuring > 0/3 projects > root project
 :config phase:  addAarDependencies
        +adding dependency: D:\work\projects\crashMe\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_479nsx45u4hr4psyx8xytrfgs.run(D:\work\projects\crashMe\platforms\android\build-tools\android-static-binding-generator\build.gradle:126)
:preBuild UP-TO-DATE
:preF0DebugBuild UP-TO-DATE
:checkF0DebugManifest
:preF0ReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAnimatedVectorDrawable2520Library UP-TO-DATE
:prepareComAndroidSupportAppcompatV72520Library UP-TO-DATE
:prepareComAndroidSupportDesign2520Library UP-TO-DATE
:prepareComAndroidSupportRecyclerviewV72520Library UP-TO-DATE
:prepareComAndroidSupportSupportCompat2520Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2520Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2520Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2520Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2520Library UP-TO-DATE
:prepareComAndroidSupportSupportV42520Library UP-TO-DATE
:prepareComAndroidSupportSupportVectorDrawable2520Library UP-TO-DATE
:prepareComAndroidSupportTransition2520Library UP-TO-DATE
:prepareCrashMeRuntimeUnspecifiedLibrary UP-TO-DATE
:prepareWidgetsReleaseLibrary UP-TO-DATE
:prepareF0DebugDependencies
:compileF0DebugAidl UP-TO-DATE
:compileF0DebugRenderscript UP-TO-DATE
:generateF0DebugBuildConfig UP-TO-DATE
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:generateTypescriptDefinitions SKIPPED
:copyTypings SKIPPED
:asbg:generateInterfaceNamesList
:asbg:traverseJsFiles
:asbg:runAstParser UP-TO-DATE
:asbg:generateBindings
Exception in thread "main" java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
D:\work\projects\crashMe\platforms\android\src\main\java\com\tns\gen\android\content\BroadcastReceiver_frnal_ts_helpers_l58_c38__BroadcastReceiver.java
        at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:59)
        at org.nativescript.staticbindinggenerator.Main.main(Main.java:15)
:asbg:generateBindings FAILED

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\work\projects\crashMe\platforms\android\build-tools\android-static-binding-generator\build.gradle' line: 251

* What went wrong:
Execution failed for task ':asbg:generateBindings'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.561 secs
Project successfully built.
Installing...
Successfully installed on device with identifier '192.168.56.101:5555'.
Transferring project files...
Successfully transferred all files.
Refreshing application...
Successfully synced application org.nativescript.crashMe on device 192.168.56.101:5555.

Executing before-watch hook from D:\work\projects\crashMe\hooks\before-watch\nativescript-dev-typescript.js
Found peer TypeScript 2.1.6
11:27:39 AM - Compilation complete. Watching for file changes.
@rosen-vladimirov
Copy link
Contributor

Thsi will be fixed with this PR: #2630

@rosen-vladimirov rosen-vladimirov self-assigned this Mar 23, 2017
@pkoleva pkoleva closed this as completed Apr 24, 2017
@pkoleva pkoleva added this to the 3.0.0 milestone Apr 24, 2017
@ishitatsuyuki
Copy link

I believe this happened when I'm using tns run android --emulator on 3.0 release. tns run android yielded the correct behavior.

Brief of output:

... errors ...
Multiple errors were thrown:
Command ./gradlew failed with exit code 1
# run android
... help dump ...
:mergeF0DebugShaders
:compileF0DebugShaders
:generateF0DebugAssets
:mergeF0DebugAssets
:transformClassesWithDexForF0Debug
:mergeF0DebugJniLibFolders
:transformNative_libsWithMergeJniLibsForF0Debug
:processF0DebugJavaRes UP-TO-DATE
:transformResourcesWithMergeJavaResForF0Debug
:validateSigningF0Debug
:packageF0Debug
:assembleF0Debug
:assembleDebug
:buildapk

BUILD SUCCESSFUL

Total time: 48.852 secs
Project successfully built.
Installing...
Successfully installed on device with identifier 'emulator-5554'.

@sitefinitysteve
Copy link

sitefinitysteve commented Jun 18, 2017

Im on 3, getting this now. Only fix seems to be platform remove\add. If I do a tns run android it's fine, but if I then do a tns build android this error happens.

@petekanev
Copy link
Contributor Author

@sitefinitysteve Is it the error that happens, or does the application indeed fire up on the device, despite the fact that the build failed?

@sitefinitysteve
Copy link

sitefinitysteve commented Jun 18, 2017 via email

@petekanev
Copy link
Contributor Author

@sitefinitysteve please refer to NativeScript/android#778 (comment) for the error you are seeing. Also the cause for the error will be less aggressive in 3.1 and print out the classes responsible. If you see that in uglify-webpacked apps - it is likely you have some extended native classes that have not been excluded from the class name mangling.

@sitefinitysteve
Copy link

sitefinitysteve commented Jun 18, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants