1

aFreeRDP is the Android client of the FreeRDP project.

I'm using 64 bit Ubuntu 15.04 Vivid.

My goal is to compile aFreeRDP. I'm at the finish line, but cannot cross it. I successfully installed the required packages, Android NDK, and then compiled the external openssl (the android shell script does that automatically). Then I generated make files. Interestingly neither

cmake -DCMAKE_TOOLCHAIN_FILE=cmake/AndroidToolchain.cmake -DANDROID_NDK=/home/csaba/android-ndk -DFREERDP_EXTERNAL_SSL_PATH=/home/csaba/GitRepos/FreeRDP/external/openssl -DANDROID_SDK=/home/csaba/android-sdk-linux

nor

cmake -DCMAKE_TOOLCHAIN_FILE=cmake/AndroidToolchain.cmake -DANDROID_NDK=/home/csaba/android-ndk -DFREERDP_EXTERNAL_SSL_PATH=/home/csaba/GitRepos/FreeRDP/external/openssl -DCMAKE_BUILD_TYPE=Debug -DANDROID_BUILD_JAVA=OFF -DANDROID_SDK=/home/csaba/android-sdk-linux -DFREERDP_EXTERNAL_JPEG_PATH=/home/csaba/GitRepos/FreeRDP/external/jpeg8d

produced any apk, but they happily compiled libfreerdp-android.so.

I need an apk, so I went to the client/Android/aFreeRDP and since I had a build.xml there, I said ant build install. The build process started, but then died at the resource compilation phase. I have the current level 23 android build tools and companion stuff with the Android SDK. I see in the source, that the source was originally targeted to level 21. I added level 21 SDK too, and tried to force maxSdkVersion to 21 in the AndroidManifest.xml, but that didn't help. The compilation log:

http://pastebin.com/Nc0mqGrQ

As you can see after resource errors

 [aapt] Generating resource IDs...
 [aapt] /home/csaba/GitRepos/FreeRDP/client/Android/appcompat_v7/res/values-v23/styles_base.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
 [aapt]
 [aapt] /home/csaba/GitRepos/FreeRDP/client/Android/appcompat_v7/res/values-v23/styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
 [aapt]

it dies

BUILD FAILED
/home/csaba/android-sdk-linux/tools/ant/build.xml:597: The following error occurred while executing this line:
/home/csaba/android-sdk-linux/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/csaba/android-sdk-linux/tools/ant/build.xml:694: null returned: 1

Comparing the level 21 and the level 23 resources, the level 21 has way more stuff, the level 23 has single entries, very vague. How can I fix this? Let me know what files should I post.


Update 1:

Get rid of an annoying issue with ADT, which could have affected this bug too: Eclipse Error: Error parsing ...\android-22\android-wear\armeabi-v7a\devices.xml Unfortunately uninstalling the Wear images made the ADT error go away, but the aFreeRDP compilation error still remained.


Update 2: I tried to go back in time and my goal was to have an Android SDK which provides 21, but doesn't have level 23. I backed up my current Android SDK. SDK download tgz 22.6.2 (https://dl.google.com/android/android-sdk_r22.6.2-linux.tgz) only provides target 21. But SDK download tgz 23.0.0 (https://dl.google.com/android/android-sdk_r23-linux.tgz) already wants to upgrade to 24. So I cannot get the system to a state, when I don't have the target 23 (which indirectly causes errors somehow - more correctly, the level 24's compatibility facility for target 23 (which satisfies target 21)), but have the target 21.

(Bonus question: why Google makes it so hard to download older SDKs? I had to fiddle and guess URLs).


Update 3:

I managed to debug aFreeRDP from Android Studio (v 1.5) using the directions github.com/FreeRDP/FreeRDP/blob/master/docs/README.android

Community
  • 1
  • 1
Csaba Toth
  • 10,021
  • 5
  • 75
  • 121
  • Apparently the Android build instructions are different now and show Android Studio too: https://github.com/FreeRDP/FreeRDP/blob/master/docs/README.android I have some weird startup problem with Android Studio currently (stuck with the startup banner and never really starts up). – Csaba Toth Feb 15 '16 at 00:33
  • I managed to debug aFreeRDP from Android Studio (v 1.5) using the directions https://github.com/FreeRDP/FreeRDP/blob/master/docs/README.android – Csaba Toth Feb 16 '16 at 07:57
  • Some years went by and now I'm back at this. Now I got stuck even earlier: there's no more `arm-linux-androideabi-gcc` binary in `~/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin` or around that `bin` directories. This gonna be hell of a doozy one again... – Csaba Toth Mar 30 '20 at 06:13

2 Answers2

1

I started with the 23.0 SDK tgz, upgraded one round (not upgrading up to Android 6.0). Then the troublesome xml files are copied over from the Android SDK. So I deleted that values-v23 folder from the SDK. I also modified the AndroidManifest.xml of the aFreeRDP and set minSdkVersion to 17 from 14. The directory deletion certainly helped, I'm not sure if the other two steps contributed, but I have an apk now. I consider this an ugly hack, only a workaround though. Because So I won't mark this as an answer for now.


Update: I started from a totally updated Android SDK, and the minSdkVersion bump from 14 to 17 also doesn't matter. The only thing which made the error go away is the invasive removal of that values-v23 directory from inside the Android SDK.


Note: The compilation is simpler than it was a year/couple of years ago. The android_setup_build_env.sh takes care of downloading and compiling ssl library and other stuff.

Csaba Toth
  • 10,021
  • 5
  • 75
  • 121
  • This still wasn't good enough to debug the project. I separated a project (I know I have some binary stuff in there) which can be debugged with Eclipse ADT. I haven't been able to debug it with Android Studio yet https://github.com/MrCsabaToth/aFreeRDP – Csaba Toth Jan 18 '16 at 03:53
  • I managed to debug aFreeRDP from Android Studio (v 1.5) using the directions github.com/FreeRDP/FreeRDP/blob/master/docs/README.android – Csaba Toth Feb 23 '16 at 03:28
1

I want to post the same topic but you already made one so I will post here. it should be comment but I dont have 50 reputation to comment so i make it answer here: Notes: (xxx = https://github.com in this post)

Reference Links: xxx/FreeRDP/FreeRDP/wiki/Compilation xxx/awakecoding/FreeRDP-Manuals/blob/master/Developer/FreeRDP-Developer-Manual.markdown and other posts from internet

Goal: Build aFreeRDP for Android devices. 2 years ago I used to build it for Ubuntu 12 / 14 but now the build is broken.

A new environment needs to setup again:

-Windows 7 Enterprise 64 bit (MAIN OS) -WMware WorkStation 10 -VM Ubuntu 15.10 Wily 64bit

Prepare Ubuntu with NDK10e, JDK7, SDK23...

shaun@ubuntu:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 15.10 Release: 15.10 Codename: wily

Install JDK

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java7-installer

Install ANDROID NDK

chmod a+x android-ndk-r10e-linux-x86_64.bin

./android-ndk-r10e-linux-x86_64.bin

sudo chown -R root:root /home/shaun/Main/android-ndk-r10e

sudo mv /home/shaun/Main/android-ndk-r10e /opt

export NDK=/opt/android-ndk-r10e

Install ANDROID SDK

Download and extract android-sdk_r23.0.2-linux.tgz

sudo mv /home/shaun/Main/android-sdk-linux /opt/android-sdk

shaun@ubuntu:/opt/android-sdk/tools$ ./android

Install dependences GIT / CMAKE / GCC

sudo apt-get install \ build-essential git-core cmake \ libssl-dev \ libx11-dev libxext-dev libxinerama-dev libxcursor-dev libxkbfile-dev \ libxv-dev libxi-dev libxdamage-dev libxrender-dev libxrandr-dev \ libasound2-dev libcups2-dev libpulse-dev \ libavutil-dev libavcodec-dev \ libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libcunit1-dev libdirectfb-dev xmlto doxygen libxtst-dev

sudo apt-get install lib32stdc++6

sudo apt-get install lib32z1

GET FreeRDP

git clone git://github.com/FreeRDP/FreeRDP.git cd FreeRDP

Add PATH

shaun@ubuntu:~$ gedit ~/.bashrc export ANDROID_NDK=/opt/android-ndk-r10e export ANDROID_SDK=/opt/android-sdk export FREERDP_EXTERNAL_SSL_PATH=/home/shaun/Main/FreeRDP-master/external/Android-external-openssl-ndk-static export PATH=$PATH:$FREERDP_EXTERNAL_SSL_PATH export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK"

from FreeRDP-->run ./scripts/android_setup_build_env.sh --> see long output .... then at the end you see: Prepared external libraries, you can now build the application.

Finally run:

cmake -DCMAKE_TOOLCHAIN_FILE=cmake/AndroidToolchain.cmake -DANDROID_NDK=$ANDROID_NDK -DANDROID_SDK=$ANDROID_SDK -DFREERDP_EXTERNAL_SSL_PATH=$FREERDP_EXTERNAL_SSL_PATH -DFREERDP_EXTERNAL_JPEG_PATH="/home/shaun/Main/FreeRDP/external/jpeg8d" -DANDROID_NATIVE_API_LEVEL:STRING=L -DCMAKE_MAKE_PROGRAM=$ANDROID_NDK/prebuilt/linux-x86/bin/make -DCMAKE_BUILD_TYPE=Debug -DANDROID_BUILD_JAVA=OFF -L . make

After this make, I have all libs i need but still fail to have APK:...

...long output.... Total time: 2 seconds client/Android/aFreeRDP/CMakeFiles/android-package.dir/build.make:50: recipe for target 'client/Android/aFreeRDP/bin/aFreeRDP-debug.apk' failed make[2]: * [client/Android/aFreeRDP/bin/aFreeRDP-debug.apk] Error 1 CMakeFiles/Makefile2:2494: recipe for target 'client/Android/aFreeRDP/CMakeFiles/android-package.dir/all' failed make[1]: * [client/Android/aFreeRDP/CMakeFiles/android-package.dir/all] Error 2 Makefile:136: recipe for target 'all' failed make: *** [all] Error 2

==========================

Import to ECLIPSE and build from Eclipse sucessfully -- APK and application run on all my devices again with new features most advanced feature is microphone redirection works as well :-)

But Still not work in ANDROID STUDIO , Still trying :(, please let me know if you have it work in AS. Thanks

sxn
  • 21
  • 4
  • I managed to build from command prompt. You don't need to download openssl and jpeg and stuff any more, the ./scripts/android_setup_build_env.sh should take care of that. In the end the cmake generates and build scripts. You can either invoke that manually later, or with the proper command the ant build tasks starts at the end. – Csaba Toth Jan 21 '16 at 17:37
  • I managed to get Eclipse ADT build also, no luck with Android Studio yet. Since we are dealing with native libs (and thus C++) also, I don't know how much Android Studio supports that. I tried to separate just the Android part (aFreeRDP with the .so libs, basically the client/Android library) into a separate space. But I haven't been successful with Android Studio yet. – Csaba Toth Jan 21 '16 at 17:45
  • Right now I still have some trouble from the fact that aFreeRDP is just a skeleton and the real meat is in the FreeRDPCore Android library project. Seems like I have to unify the two and not use Android library in order to finish my project. – Csaba Toth Jan 21 '16 at 17:46
  • My case: if android-ndk-profiler not installed properly--> ./scripts/android_setup_build_env.sh will be error – sxn Jan 22 '16 at 19:40
  • I don't remember any hoops about the `NDK`. I followed simple instructions, set up paths and env variables. The `android_setup_build_env.sh` worked for me right away, and I realized it does all the ssl and stuff. I'm currently using Ubuntu Studio, based on 15.04 (I'll dist upgrade soon), it's Xfce4 based. – Csaba Toth Jan 22 '16 at 19:58
  • just confirm: you are correct. android_setup_build_env.sh is enough, compilation is much simpler than before :) – sxn Jan 27 '16 at 18:18
  • 1
    Update: Successfully integrated in Android Studio , need to Make Project, Make Module and Compile from Build Menu in Studio Android. – sxn Jan 27 '16 at 21:07
  • I managed to debug aFreeRDP from Android Studio (v 1.5) using the directions https://github.com/FreeRDP/FreeRDP/blob/master/docs/README.android – Csaba Toth Feb 16 '16 at 07:57
  • It is simple with New git and new guild now, all goes well to get APK, but RDP session not work, it keep spinning and say connecting. Anyone experience this? Also, there are more lib files, and libfreerdp-android.so is only 288kb – sxn Mar 10 '16 at 18:13
  • I cannot confirm cause I haven't had time for this project lately – Csaba Toth Mar 10 '16 at 19:16
  • @ Csaba Toth: Does your aFreeRDP handle the screen rotation in RDP session? it crashed on mine – sxn Apr 04 '16 at 17:25
  • you mean my clone of the repo? I haven't paid attention to the rotation yet. My repo is lagging behind, work from the original, and if you can reproduce it, that deserves a ticket in the original repo. – Csaba Toth Apr 04 '16 at 18:23