mmozeiko
Cool, you are doing almost exactly same thing I do with building Android stuff! :)
The problem is that you have android:debuggable set for wrong XML tag. It should be specified for "application" tag, not "manifest". See here: https://developer.android.com/gui...st/application-element.html#debug
Alternative is to use --debug-mode for aapt when you call it for "package" - it will automatically insert this attribute for application.
I think you should move build files (.o) out from output directory. Otherwise "aapt package will add "obj" folder in apk file and you don't need it. It also takes debug.keystore file and puts in apk file.
Wow of course its something that easy. Thanks a lot. I ended up adding the debug-mode tag to the aapt call and the debugging error in visual studio went away! Thanks for the comment on build files being added to the apk. I did a bunch of testing and it seems like the apk wants the .so files to be in a specific path (eg: lib\x86\
lib.so) so I just made aapt look for files in that folder instead of in the whole OutputDir. This is what my batch file currently looks like:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 | @echo off
set CodeDir=W:\untitled\code
set OutputDir=W:\untitled\build_android
set AndroidDir=%ProgramFiles(x86)%\Android\android-sdk
set AndroidCmdDir=%AndroidDir%\build-tools\21.1.2
set NdkBuildCommands=-B NDK_DEBUG=1 %NdkBuildCommands%
set NdkBuildCommands=APP_BUILD_SCRIPT=%CodeDir%\android\Android.mk %NdkBuildCommands%
set NdkBuildCommands=NDK_APPLICATION_MK=%CodeDir%\android\Application.mk %NdkBuildCommands%
set NdkBuildCommands=-C %CodeDir%\android %NdkBuildCommands%
set NdkBuildCommands=NDK_PROJECT_PATH=%CodeDir%\android %NdkBuildCommands%
set NdkBuildCommands=NDK_LIBS_OUT=%OutputDir%\lib\lib %NdkBuildCommands%
set NdkBuildCommands=NDK_OUT=%OutputDir%\obj %NdkBuildCommands%
call ndk-build %NdkBuildCommands%
REM Create Keystore for signing our apk
REM call keytool -genkey -v -keystore %OutputDir%\debug.keystore -storepass android -alias androiddebugkey -dname "CN=company name, OU=0, O=Dream, L=Toronto, S=Ontario, C=CA" -keyalg RSA -keysize 2048 -validity 20000
pushd %OutputDir%
del *.apk >NUL 2> NUL
popd
REM Create APK file
call "%AndroidCmdDir%\aapt" package --debug-mode -f -M %CodeDir%\android\AndroidManifest.xml -S %CodeDir%\android\res -I "%AndroidDir%/platforms/android-19/android.jar" -F %OutputDir%\AndroidTest.unsigned.apk %OutputDir%\lib
call jarsigner -sigalg SHA1withRSA -digestalg SHA1 -storepass android -keypass android -keystore %OutputDir%\debug.keystore -signedjar %OutputDir%\AndroidTest.signed.apk %OutputDir%\AndroidTest.unsigned.apk androiddebugkey
"%AndroidCmdDir%\zipalign" 4 %OutputDir%\AndroidTest.signed.apk %OutputDir%\AndroidTest.aligned.apk
|
I tried setting a breakpoint in my app but it says that the module hasn't been loaded or the breakpoint address could not be found so the break point is never hit. If I break all, it seems to be executing
libc.so code so visual studio cannot find the symbols. The app itself runs properly on the emulator I'm testing so is this just a visual studio problem? I added the extra symbols path to include the path where my main.c is so visual studio should know where my code for the android program is.
Hugo - whatever code you make in straight C on android for the platform layer will probably be similar to what you write in Java anyways so if anything, writing everything in one language is more consistent and easier to maintain.
EDIT: It seems that for visual studio to find your symbols, you have to set the additional symbols path to your obj folder instead of your code folder. Doing this allowed me to step through my code successfully but if I ever called break all, it would still say that the symbols for
libc.so could not be loaded. I guess I'll research that error a bit more but for now, I can actually debug the app and start building my own. Thanks a lot mmozeiko for the help!!!