Can we debug the APK with ASAN active on Android Studio? - android

My project is a simple game with native C++ code and Java, which uses cmake to compile C/C++ code. I'm using address sanitizer to check my the code. I follow the instruction here
My OS is windows 10 64bit.
However, when I press debug on Android Studio, I got the message as
2020-03-19 13:50:56.946 5152-5152/? E/logwrapper: executing /data/app/com.indie.haiphan.Breakout-ZFFz_f8ETleajrgP6rg9gw==/lib/arm64/wrap.sh failed: No such file or directory
2020-03-19 13:50:56.946 5151-5151/? I/wrap.sh: executing /data/app/com.indie.haiphan.Breakout-ZFFz_f8ETleajrgP6rg9gw==/lib/arm64/wrap.sh failed: No such file or directory
2020-03-19 13:50:56.956 5151-5151/? I/wrap.sh: wrap.sh terminated by exit(255)
2020-03-19 13:50:56.957 873-873/? W/Zygote: Error reading pid from wrapped process, child may have died
I checked on my APK (with Analyze APK of Android Studio) the wrap.sh exist.
So my question is I can't debug with wrap.sh inside the APK?
Thanks

You probably have BOM or an extra carriage return at the end of the first line of your wrap.sh. Which is possible in windows.
To fix it you can use dos2unix tool.
See this: https://unix.stackexchange.com/a/27067/197738

Related

stuck on creating 'moor_database.g.dart'

I wanted to generate file 'moor_database.g.dart' by typing the command 'flutter packages pub run build_runner watch' but after doing some procedures it just tells: [INFO] Succeeded after 9.0s with 0 outputs (4 actions)
And inside the terminal results I saw this warning:
[WARNING] moor_generator:moor_generator on lib/data/moor.dart: Missing "part 'moor.g.dart';".
I had this message because I had my own file called moor.dart which conflicted with the moor library file (that's why that command was not working properly) but Android Studio didn't give any direct errors or warning on that, after renaming my file name, everything worked

Cannot find src/main/jni from the Android Studio project

In order to use NDK in my application, I included an external tool at Preferences -> Tools -> External Tools.
Here's what I did.
As I right-clicked a class and chose the external javah command to create a c class, it didn't work and left a following message.
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: /src/main/jni
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:129)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:107)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64)
at com.sun.tools.javah.JavahTask.run(JavahTask.java:503)
at com.sun.tools.javah.JavahTask.run(JavahTask.java:329)
at com.sun.tools.javah.Main.main(Main.java:46)
Process finished with exit code 1
I properly created the jni folder under the main directory, and I'm still not clear why I keep getting this message.
Here's my development environment.
OS: OS X El Capitan
Android Studio: 2.2.2
I solved this problem by modifying the Parameters and Working Directory as follows.
Parameters: -classpath $Classpath$ -v -jni $FileClass$
Working Directory: $ProjectFileDir$/app/src/main/jni

Cannot debug Android application with native code

I'm trying to debug native application in Eclipse. Unfortunately, when I run "Debug As-> Android Native Application" I see the following errors in the console:
[2014-09-10 21:03:48 - GenderDetector] Verify if the application was built with NDK_DEBUG=1
[2014-09-10 21:04:16 - GenderDetector] gdbserver output:
[2014-09-10 21:04:16 - GenderDetector] run-as: Package 'com.opencv.genderdetector' is unknown
If I try to add "NDK_DEBUT=1" to the ndk-build command I see the following errors:
[armeabi-v7a] Gdbserver : [arm-linux-androideabi-4.9] libs/armeabi-v7a/gdbserver
install: cannot stat ‘/home/yury/software/android-ndk/prebuilt/android-arm/gdbserver/gdbserver’: No such file or directory
make: *** [libs/armeabi-v7a/gdbserver] Error 1
Could someone please explain what I'm doing wrong?
Here is a steps that may help you :
Check if /home/yury/software/android-ndk/prebuilt/android-arm/gdbserver/gdbserver is exsits
Check if it has execution permission.
Add this path to your environment variables this maybe will help.
Make sure your android-ndk folder is complete as it comes from google when you download.
Regards.
Build your application like this : ndk-build NDK_DEBUG:=1 APP_OPTIM:=debug
This enables the debug flag and also creates symbol files used by the debugger. You will see 2 files gdbserver.so and gdb.setup created within jni/libs folder. After this is done, you are good to debug as native application.
I meet this error when I use android-ndk-r10. After I uses android-ndk-r10e, this error disappear.

Can't dump the symbols of my native library : loadDataForPdb and loadDataFromExe failed

I copied the sample of Google breakpad for Android and added it to my project. I had first a problem to get the minidumps (I was triggering SIGSEGV errors but nothing was written on my SD card). I finally managed to get some minidumps (I don't really know how but that's not my main problem).
My problem is that I can't dump the symbols of my native libraries, it says the following error message :
dump_syms.exe libcppinterface.so > libcppinterface.so.sym
loadDataForPdb and loadDataFromExe failed
Open failed
Thanks for your help
The Breakpad tools are not very cross-platform friendly. You need to build dump_syms on a Linux machine in order to get a dump_syms binary that can read ELF/DWARF and produce debug symbols from your Android binaries. The Windows dump_syms.exe is only used for dumping symbols from MSVC-produced PDB files.

Jenkins-CI SCP Plugin cannot find files to upload

I have Jenkins-CI compiling an Android app I'm working on. Compiles it great but it will not upload the release apk via SCP. I have set the source to bin/* and it gives me the following error. Does anyone have a suggestion on what I have configured wrong? I've had it working in the past, but I forgot to get the config before I re-installed Fedora on the machine.
[SCP] Connecting to smccloud.com
ERROR: Failed to upload files
2: No such file
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2289)
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:1741)
at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:1758)
at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:1715)
at be.certipost.hudson.plugin.SCPSite.upload(SCPSite.java:188)
at be.certipost.hudson.plugin.SCPRepositoryPublisher.perform(SCPRepositoryPublisher.java:218)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:682)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:657)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:635)
at hudson.model.Build$RunnerImpl.post2(Build.java:161)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:604)
at hudson.model.Run.run(Run.java:1400)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:175)
Build step 'Publish artifacts to SCP Repository' changed build result to UNSTABLE
I encountered this error when I was trying to copy to a directory that didn't exist on the target machine. Create the directory(s) on the target first and this should go away and the copy work.
On the target machine you are seeing something like:
No such file or directory
when you try to navigate to the non-existent directory.
If the plugin isn't working for you can use the shell script with expect, as a post build step, to do it for you.

Categories

Resources