SDK » History » Revision 58

Revision 57 (Denis 'GNUtoo' Carikli, 01/31/2023 12:06 AM) → Revision 58/61 (Denis 'GNUtoo' Carikli, 01/31/2023 12:39 AM)

h1. SDK 

 {{toc}} The [[ReplicantSDK]] page holds a list of the released Replicant SDK builds. 

 h2. Introduction Rationale 

 The Up till version 4.2, Replicant provided its own SDK, built from source, since the Android SDK as released by Google is distributed under a non-free license and suggests installing non-free plug-ins such as the Google APIs. 

 The Replicant 4.2 SDK contains only free software and earlier provided its own SDK, built will not check for plug-ins or updates from source. The [[ReplicantSDK]] page holds a list of the previously released Replicant SDK builds. Google. 

 With From Replicant 6.0, 6.0 onward "there was no longer the need to provide a Replicant didn't invest time into releasing an SDK since several FSF certified SDK": because some fully-free GNU/Linux distributions already shipped an provide packages for the Android 6.0 compatible SDK. The associated "blog post": has more details about this choice. 

 After Android 6.0 there isn't any good enough solutions yet. 

 h2. GNU/Linux distributions 

 The following FSF certified distributions have Android SDKs: 

 | Distribution           | Status                                                                       | Gradle version    | Android versions     | 
 | PureOS amber           Debian    9 (stretch)    | 4.4.1 Has android-sdk packages[2]                                                  | 3.2.1             | 6.0 (API Level 23) | 
 | Trisquel 9 (etiona)    Debian 10 (buster)     | 3.4.1             Has android-sdk packages[3]                                                  | 6.0 (API Level 23)                   |                      | 
 | Trisquel 10 (nabia)    Debian 11 (bullseye) | Has android-sdk packages[4]                                                  | 4.4.1             | 6.0 (API Level 23) | 

 At the time of writing, Guix, Hyperbola, 
 | Parabola don't have an SDK, and the other FSF certified distributions weren't checked but are unlikely to have packages for an Android SDK. 

 The following distributions are also known to have an Android SDK:               | "WIP": that stalled in 2018 |                   |                      | 
 | Distribution           Trisquel 7 (belenos) | Gradle version Has android-sdk packages[1]                                                  |                   |                      | 
 | Trisquel 8 (flidas)    | Android versions     Has android-sdk packages[1]                                                  |                   |                      | 
 | Debian    Trisquel 9 (stretch) (etiona)    | 3.2.1 Has android-sdk packages[1]                                                  | 3.4.1             | 6.0 (API Level 23) | 
 | Debian Trisquel 10 (buster)     (nabia)    |                   Has android-sdk packages[1]                                                  |                      | 
 | Debian 11 (bullseye) | 4.4.1             | 6.0 (API Level 23) | 

 The [[F-DroidAndApplications]] wiki page 

 There is also has information the "Android Rebuilds": project that provides a free Android SDK, built from the Android source code. So it probably works on attempts most of the the GNU/Linux distributions that exist, however, at the time of writing, it is still relied on Google's prebuit toolchain (which is free software) to build Android the SDK. 

 fn1. The packages with these SDKs. are based based on "android-sdk-meta": by the Debian project. 




 h2. Attempts Installation of the Replicant SDK 

 After downloading the Replicant SDK from the [[ReplicantSDK]] page, it should work the same as the Android SDK as provided by Google except that the Replicant SDK already contains a built and ready to go use emulator image.  
 Please refer to: for further than assistance.  

 h3. Dependencies 

 h4. Required Packages 

 The Replicant SDK requires the following packages: 
 * SDL 
 * OpenJDK 6 
 * Ant 

 In some unlikely cases, creating a "JAVA_HOME" environment variable and pointing it to your JDK's true install location (not the "bin" directory but one level upward) may prove necessary. 

 h5. Additional requirements for amd64 

 Note that the Replicant SDK is built for x86 platforms and you may need compatibility libraries such as @ia32-libs@. 

 h4. Command line installation 

 h5. Trisquel/Ubuntu/Debian 

 Required packages: 
 apt-get install libsdl1.2debian openjdk-6-jdk ant 

 Additional requirements for amd64: 
 apt-get install ia32-libs 

 h2. Rebuilding the SDK from sources 

 See [[SDKBuild]]. 

 h2. Usage guides 

 h3. Using Eclipse 

 You may want to install Eclipse to work on Android 6.0 Java applications. Note that this is not strictly necessary as all the required tools are already present on the SDK package.  

 h4.    Installing the "Android Development Tools" plugin for Eclipse 

 At some The following instructions work with Eclipse 3.7.2 (Indigo) as installed via Apt under Trisquel Toutatis GNU/Linux. 
 sudo aptitude install eclipse 

 Once you have Eclipse installed and running properly, you may want to install the Android Development Tools plugin. 

 * The Replicant 4.0 SDK requires ADT version 16 while the Replicant 4.2 SDK requires ADT version 20. You will need to download it from Google's archives and then manually install it in Eclipse: 

 * in Eclipse 3.7 

 - select "Window" > "Preferences" > "Install/Update" > "Available Software Sites" 
 - click the "Add" button 
 - name your software site something recognizable, e.g. "ADT" 
 - click "Archive" and select the ADT zip file 

 * in Eclipse 3.7 

 - select "Help" > "Install New Software" 
 - select the "ADT"/ software site from the dropdown menu 
 - select the "Developer Tools" software package 
 - verify that the "Android DDMS" and "Android Development Tools" sub-packages were selected 
 - click the "Next" to install Android Developer Tools 

 * restart Eclipse 

 h4. Pointing "Android Development Tools" to the SDK directory 

 When you have installed ADT and restarted Eclipse, select the "Window" menu. You should see a menu entry named "Android SDK and AVD Manager". Then select "Preferences" from the "Window" menu. A menu item named "Android" should be available on the left panel. 

 Once the "Android" menu item is available in the "Window" > "Preferences" dialog, select it. In the main panel, click the "Browse" button for the "SDK Location" field, and point there was it to the directory where you unzipped your Replicant 4.2 SDK. Then click "Apply" or "OK". 

 Next time you enter this dialog, a line saying "Android 4.2.2 / Android Open Source Project / Platform: 4.2.2 / API level: 17" should be present in the list of SDK targets. 

 h3. Writing a "Hello World" app in Eclipse 

 h4. Creating an Android Rebuilds Virtual Device 

 To run your app in an emulator, you need to create an Android Virtual Device. In Eclipse, choose "Window" > "Android SDK and AVD Manager" > "Virtual Devices" > "New" and fill in the properties of the virtual device as follows: 

 - Name: something descriptive like "AVD_for_Nexus_S" 
 - Screen resolution of your physical device, e.g. "WVGA800" for Nexus S 
 - Target: choose "Android 4.2.2 - API level 17" from the dropdown menu 
 - SD Card: specify the size of an emulated SD card, alternatively browse for an existing SD card image 
 - leave other values at defaults and click "Create AVD" 
 - if your disk is slow and you specified a large SD card image for creation, it may take a few seconds to complete 

 h4. Creating a project that provided free SDKs at but 

 In Eclipse, choose "File" > "New" > "Project". In the author mentions that tree of possible project types, a branch named "Android" should exist. Open it, select the project ended type "Android Application Project" and click "Next". 

 Enter a friendly name for your application, e.g. "Hello World", then a name for your project, e.g. "hello". Enter its package name, which can be either public (e.g. "com.example.hello") or private (e.g. "hello.test"). 

 For "Configure", select "Create project in 2021[1].  

 That workspace" and use default location. The project also lacked will be created in your local Eclipse workspace directory, in a license. That led "another subdirectory corresponding to the project by wchen342": name. Leave the minimum SDK version as-is. 

 If you want the first piece of your application's user interface to restart from scratch.  

 Wchen342's reimplementation is tested ungoogled-chromium-android be auto-created, leave the "Create Activity" checkbox checked and uses debian 12 (bookworm) through docker. It enter someting like "MainActivity" for the name of the "Activity" class to create. 

 Finally click "Finish" and your project should appear in Eclipse's left-hand projects tree. 

 h4. Adding some code and resources into a project 

 To have your application's MainActivity class do something, consider adding some code. For example, you might want your application to have a button which closes it. In this sample, we specify the design of user interface elements in a separate XML resource file, so don't be possible surprised when you don't see anything related to use PureOS instead when their design here: 

 <pre>package hello.test; 

 import android.os.Bundle; 
 import android.view.View; 
 import android.widget.Button; 

 public class MainActivity extends Activity { 

     public void onCreate(Bundle savedInstanceState) { 
         Button buttonFinish = (Button) findViewById(; 
         buttonFinish.setOnClickListener(new View.OnClickListener() { 
			 public void onClick(View v) { 

 You may notice how the equivalent PureOS version constructor of MainActivity calls @setContentView(R.layout.main)@. In this statement, @R@ is released. a special resource class, pointing to resources hosted in the @res@ directory of your project. The @layout@ class limits the choice to layout resources hosted under the @res/layout@ while @main@ is the name of a layout resource file @main.xml@ located there. 

 F-Droid also has We need to create this resource file now. I would recommend having it be like this: 

 <pre><?xml version="1.0" encoding="utf-8"?> 
 <LinearLayout xmlns:android="" 
     android:text="Click button to close app." 
 <Button android:id="@+id/buttonFinish" 
     android:text="Close" /> 

 Together, it makes sense. The "LinearLayout" element directs the application to fill the screen with its window ("fill_parent" for width and height). The "TextView" element displays a "forum post": that asks text field expanding to cover window width, but limits itself to content height ("wrap_content"). The "Button" element is a button named "buttonFinish", big enough to accommodate its content. Code obtains a handle to it by calling "Button buttonFinish = (Button) findViewById(;"), and creates an event listener for help with that as they currently rely its OnClick event. This event listener calls "finish()" to close the app. 

 h4. Running the app on an Android Virtual Device 

 Once you've coded your app, choose "Run" > "Run" in Eclipse. A dialog named "Android Device Chooser" will open, asking you to choose a device for it. Select the nonfree SDKs "Launch a new Android Virtual Device" checkbox and they want to fix that. the virtual device you previously made, should become available for selection (select it and click "OK"). The virtual device will start booting up and will eventually run your app. Beware, on slow computers (e.g. an old model of Asus EEE PC) this can take minutes. 

 fn1. h4. Running the app on a real Replicant device 

 1. Declare your app as debuggable. In the left-hand sidebar of Eclipse, your project's resource tree should contain a file resource named "AndroidManifest.xml". Right-click it and choose "Open With". Proceed by choosing either "Android Rebuilds, how Manifest Editor" or "Text Editor". If you preferred the manifest editor GUI, select the tab "Application" at its bottom. On the "Application" tab, set the field "Debuggable" to rebuild SDK/NDK, precisely, without non-free EULA (2015-2021)" "true". If you preferred the text editor, append the property "android:debuggable="true" to the "<application>" element. 

 2. Enable USB debugging on your device, for example by choosing "Menu" > "Settings" > "Applications" > "Development" and checking the "USB Debugging" checkbox. 

 h2. Replicant SDK 3. Set up [[ADB]] on your PC. 

 See [[ReplicantSDKUsage]] Do the verification by issuing "adb devices" on command line. Make your your ADB (Android Debug Bridge) is included in your @$PATH@ variable. If it lists your device and its numeric ID, all should be fine. If it lists @?????????@ for more details about SDKs up the ID and says @No permissions@, you might need to Replicant 4.2. 
 restart the ADB server (issue @adb kill-server; adb start-server@). 

 4. Run the app. Without a customized run configuration, Eclipse should display the "Android Device Chooser" dialog, letting you choose.  

 5. Optionally, configure automatic deployment: if you want to automatically deploy to devices when they're attached, create a run configuration for your app, proceeding to select "Deployment Target Selection Mode: Automatic" in the "Target" tab.