I am trying to get coverage report by running ant emma on my mavenized android project, everything else went smoothly, but i bumped into NullPointerException when running
ant emma debug install test.
output is:
test:
[echo] WARNING: Code Coverage is currently only supported on the emulator and rooted devices.
[echo] Running tests ...
[exec]
[exec] com.jayway.maven.plugins.android.generation2.samples.libraryprojects.mainapp.MainActivityTest:INSTRUMENTATION_RESULT: shortMsg=java.lang.NullPointerException
[exec] INSTRUMENTATION_RESULT: longMsg=java.lang.NullPointerException: Unable to start activity ComponentInfo{com.jayway.maven.plugins.android.generation2.samples.libraryprojects.mainapp/com.jayway.maven.plugins.android.generation2.samples.libraryprojects.mainapp.MainActivity}: java.lang.NullPointerException
[exec] INSTRUMENTATION_CODE: 0
[echo] Downloading coverage file into project directory...
[exec] remote object '/data/data/com.jayway.maven.plugins.android.generation2.samples.libraryprojects.mainapp/coverage.ec' does not exist
How can I debug this ? I would like to find out where the NPE happened.
Related
Soo... everything worked fine then after taking a break from work apps wont run.
New or empty project it does not matter.
Flutter doctor says everything is fine.
Here is Debug console.
Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
lib/main.dart:1
Xcode build done. 3.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/bm/_wgnp7b94l78gc2g88cq3kbc0000gn/T/flutter_tools.MW6UxN/flutter_ios_build_temp_dirktvpW1/temporary_xcresult_bundle
/Applications/flutter/packages/flutter/lib/src/widgets/ticker_provider.dart:186:7: Error: 'ethrow' isn't a type.
ethrow FlutterError.fromParts(<DiagnosticsNode>[
^^^^^^
/Applications/flutter/packages/flutter/lib/src/widgets/ticker_provider.dart:186:14: Error: Expected ';' after this.
ethrow FlutterError.fromParts(<DiagnosticsNode>[
^^^^^^^^^^^^
/Applications/flutter/packages/flutter/lib/src/widgets/ticker_provider.dart:186:26: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
ethrow FlutterError.fromParts(<DiagnosticsNode>[
^
/Applications/flutter/packages/flutter/lib/src/widgets/ticker_provider.dart:195:6: Error: A value of type 'bool?' can't be assigned to a variable of type 'bool' because 'bool?' is nullable and 'bool' isn't.
}());
^
Failed to package /Users/stankoo003/minimal_design.
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/bm/_wgnp7b94l78gc2g88cq3kbc0000gn/T/flutter_tools.MW6UxN/flutter_ios_build_temp_dirktvpW1/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro Max.
Exited
flutter doctor, empty projects..
This shows a problem in Flutter's TickerProvider class.
It might be a version problem. Try flutter upgrade.
Clean your project flutter clean then flutter pub get and try building again.
I am getting the following error while trying to make titanium build with 3.0.0.GA using ant scripting
[exec] [ERROR] Error(s) compiling generated Java code
[exec] [ERROR] D:\Workarea\experiment\teacher\digitallyTE\build\android\gen
\com\edurite\digiteacher\DigitallyteApplication.java:36: cannot find symbol [exec] symbol : class AssetCryptImpl [exec] location: class com.edurite.digiteacher.DigitallyteApplication [exec] KrollAssetHelper.setAssetCrypt(new AssetCryptImpl()) ; [exec] ^ [exec] Note: D:\Workarea\experiment\teacher\digitallyTE\build\android\gen\c om\edurite\digitallyTE\AssetCryptImpl.java uses unchecked or unsafe operations. [exec] Note: Recompile with -Xlint:unchecked for details. [exec] 1 error [exec]
BUILD FAILED D:\Workarea\experiment\teacher\build.xml:11: exec returned: 1
Quite a while ago that the question was asked. But I guess my findings could be interesting as a AssetCryptImpl.java:44: error: cannot find symbol error happened to me lastly. The AssetCryptImpl.java template is filled with some asset variables during the build (check ~/.titanium/mobilesdk/linux/6.1.0.GA/android/cli/commands/_build.js). This process depends at least on Linux on some system commands. Those commands failed with a Segmentation Fault during my builds. Thus the asset variables don't get rendered inside the AssetCryptImpl.java template and the Java compiler will complain about missing symbols.
Check your build output for a line like
[INFO] : Encrypting JavaScript files: /home/simon/.titanium/mobilesdk/linux/6.1.0.GA/android/titanium_prep.linux64 "com.example.id" "/home/simon/test/Asdf/build/android/assets" "alloy/CFG.js" "app.js" "alloy/backbone.js" "alloy/constants.js" "alloy/controllers/BaseController.js" "alloy/controllers/index.js" "alloy/styles/index.js" "alloy/sync/localStorage.js" "alloy/sync/properties.js" "alloy/sync/sql.js" "alloy/underscore.js" "alloy/widget.js" "alloy.js" "ti.cloud/ti.cloud.js" "_app_props_.json"
and try to run the included command.
I get the following error when I run the following code coverage test using ant:
ant emma debug install test
I am running this from an Ubuntu 12.10 terminal. The JUnit4 library was properly added into my eclipse test project.
The test project is a simple Android test project. I don't understand why I get the "didn't find class org.junit.test on path..." do I need to add specify more, so that the build knows to also package junit in the resulting test APK?
-post-build:
debug:
install:
[echo] Installing /home/jes/IDTest/bin/StartupActivityTest-debug.apk onto default emulator or device...
[exec] 1017 KB/s (37974 bytes in 0.036s)
[exec] pkg: /data/local/tmp/StartupActivityTest-debug.apk
[exec] Success
-set-mode-check:
-set-instrumented-mode:
install:
[echo] Installing /home/jes/android/bin/StartupActivity-instrumented.apk onto default emulator or device...
[exec] 1171 KB/s (9168346 bytes in 7.642s)
[exec] pkg: /data/local/tmp/StartupActivity-instrumented.apk
[exec] Success
installi:
-check-env:
[checkenv] Android SDK Tools Revision 21.1.0
[checkenv] Installed at /home/jes/Development/sdk
-setup:
[echo] Project Name: StartupActivityTest
[gettype] Project Type: Test Application
-test-project-check:
test:
[getlibpath] Library dependencies:
[getlibpath]
[getlibpath] ------------------
[getlibpath] Ordered libraries:
[echo] Running tests...
[echo] Running tests ...
[exec] INSTRUMENTATION_RESULT: shortMsg=java.lang.ClassNotFoundException
[exec] INSTRUMENTATION_RESULT: longMsg=java.lang.ClassNotFoundException: Didn't find class "org.junit.Test" on path: /system/framework/android.test.runner.jar:/data/app/test-1.apk:/data/app/ocr-2.apk
[exec] INSTRUMENTATION_CODE: 0
[echo] Setting permission to download the coverage file...
[exec] Unable to chmod /data/data/ocr/coverage.ec: No such file or directory
[echo] Downloading coverage file into project directory...
[exec] remote object '/data/data/ocr/coverage.ec' does not exist
BUILD FAILED
/home/jes/Development/sdk/tools/ant/build.xml:1284: exec returned: 1
After upgrading to android sdk tools v14 and updating existing projects to last project structure, ant test fails with the error message:
test:
[echo] Running tests ...
[exec] Syntax error: Bad substitution`
Output of ant -v test
[echo] Running tests ...
[exec] Current OS is Mac OS X
[exec] Executing '/opt/local/share/java/android-sdk-mac_x86/platform-tools/adb' with arguments:
[exec] 'shell'
[exec] 'am'
[exec] 'instrument'
[exec] '-w'
[exec] '-e'
[exec] 'coverage'
[exec] 'false'
[exec] 'xxx.xxx/xxx.xxx'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
But directly execute command adb shell am instrument is fine.
My environment is Apache Ant(TM) version 1.8.2 on Mac.
Please help.
It is a known issue of r14 tools. See http://tools.android.com/knownissues
Testing
ant test fails with Syntax error: Bad substitution.
A last minute change introduced this error in the Ant rules file. The workaround is to edit /tools/ant/build.xml, line 318 and to change ${manifest.package} with ${tested.manifest.package}. [Issue 20979]
I use http://code.google.com/p/the-missing-android-xml-junit-test-runner/ to run unit tests in jenkins environment.
One sample project worked well, but for another there are strange results.
Ant outputs
[echo] Running tests ...
[exec]
[exec] Test results for PolideaInstrumentationTestRunner=
[exec] Time: 0.0
[exec]
[exec] OK (0 tests)
[exec]
[exec]
and so does adb shell am instrument -w com.mypack.tests/pl.polidea.instrumentation.PolideaInstrumentationTestRunner.
It thinks that there are no tests but there are. They successfully run from eclipse.
The reason was:
in build.properties there was relative source.dir. Something like:
source.dir=src;./../../../other.package/src;./../../and.other/src
It compiled well, but prevented tests to run. When I set paths to absolute:
source.dir=${workspace}/my.package/src;${workspace}/other.package/src;${workspace}/and.other/src
tests do run.