1.I will explain how to use the three-party SDK smart deployment tool by implementing the Twitter login SDK
The first is to post Twitter related documents and native examples

Development document address


How to use Android SDK


Sample download address:




2.Download the Android SDK for Twitter

Mainly twitter-core.aar

Others are dependent packages



3.Download the three-party SDK smart deployment tool


Or download the source code and compile it yourself:


The interface of the three-party SDK smart deployment tool is as follows:




4.First click the “Select Project” button to select the project to be configured



5.Then click the “Add Android Jar” button to add all jars, and then click “Process Android Jar”
Click the “Add Android Aar” button, add the desired aar, and then click “Process Android Aar”

Jar and aar have been added to the project

The Aar package is also decompressed, and the resources in it are deployed to the project



6.Next, translate the jar into a Delphi calling unit, call it in the form, first create a Twitter button and display it on the form

Button“Create Login Button”

Button “Get user info”




7.Then run to the real machine to check the effect, click “Create Login Button”, an exception will pop up,


Because the aar package needs to access the resources in its own package, we need to generate the R.java of the aar package and package it into a jar to add to the project.

You need to click the “Generate R.jar” button

It will generate R.jar and add it to the project



8.Compile and run to the real machine to see the effect






9.If the resource file deployment of the project has been changed, you need to click the “Generate R.jar” button again. If you find this troublesome, you can use OrangeSDKHelper.exe to automatically handle it.
Configure Post-build events in the project as:

“C:\OrangeFreeSDK\OrangeSDKSmartDeployment\Win32\Debug\OrangeSDKHelper.exe” $(PROJECTPATH)

After each compilation, you can view related information in the Output page

  1. 我会以实现推特登陆SDK来讲解如何使用三方SDK智能布署工具
  2. 首先是贴出推特相关文档和原生示例








  1. 下载推特的Android SDK



  1. 再下载三方SDK智能布署工具






  1. 先点击“Select Project”按钮来选择要配置的工程

  1. 再点击”Add Android Jar”按钮,添加所有的jar,再点击”Process Android Jar”

点击”Add Android Aar”按钮,添加所要的aar,再点击“Process Android Aar”



  1. 接下来将jar翻译成Delphi的调用单元,在窗体中进行调用,先创建推特按钮,显示在窗体上

Button“Create Login Button”

Button “Get user info”

  1. 接下来运行到真机上查看效果,点击“Create Login Button”,会弹出一个异常,



您需要点击“Generate R.jar”按钮


  1. 再编译并运行到真机查看效果




  1. 如果工程的资源文件布署被改动过之后,需要重新点击“Generate R.jar”按钮,如果你嫌这个麻烦,那么可以使用OrangeSDKHelper.exe来自动处理

在工程中配置Post-build events为:

“C:\OrangeFreeSDK\OrangeSDKSmartDeployment\Win32\Debug\OrangeSDKHelper.exe” $(PROJECTPATH)


Getting Started




dependencies {

compile ‘com.twitter.sdk.android:twitter-core:3.1.1’

compile ‘com.twitter.sdk.android:tweet-ui:3.1.1’

compile ‘com.twitter.sdk.android:tweet-composer:3.1.1’

compile ‘com.twitter.sdk.android:twitter-mopub:3.1.1’





<string android:name=”com.twitter.sdk.android.CONSUMER_KEY”>XXXXXXXXXXX</string>

<string android:name=”com.twitter.sdk.android.CONSUMER_SECRET”>XXXXXXXXXXX</string>



public class CustomApplication {

public void onCreate() {





public void onCreate() {

TwitterConfig config = new TwitterConfig.Builder(this)

.logger(new DefaultLogger(Log.DEBUG))

.twitterAuthConfig(new TwitterAuthConfig(“CONSUMER_KEY”, “CONSUMER_SECRET”))





用推特登陆: Log In with Twitter:


登陆方式一: Log In Button

import com.twitter.sdk.android.core.Callback;

import com.twitter.sdk.android.core.Result;

import com.twitter.sdk.android.core.TwitterException;

import com.twitter.sdk.android.core.TwitterSession;

import com.twitter.sdk.android.core.identity.TwitterLoginButton;

loginButton = (TwitterLoginButton) findViewById(R.id.login_button);

loginButton.setCallback(new Callback<TwitterSession>() {


public void success(Result<TwitterSession> result) {

// Do something with result, which provides a TwitterSession for making API calls



public void failure(TwitterException exception) {

// Do something on failure




TwitterSession session = TwitterCore.getInstance().getSessionManager().getActiveSession();

TwitterAuthToken authToken = session.getAuthToken();

String token = authToken.token;

String secret = authToken.secret;

请求获取用户的邮箱地址:Request User Email Address

Before using this feature, ensure that “Request email addresses from users” is checked for your Twitter app.

TwitterAuthClient authClient = new TwitterAuthClient();

authClient.requestEmail(session, new Callback<String>() {


public void success(Result<String> result) {

// Do something with the result, which provides the email address



public void failure(TwitterException exception) {

// Do something on failure



The function introduction of the three-party SDK smart deployment tool (supports both Chinese and English)


Because I often need to dock some third-party SDKs in the process of developing APP, in order to improve work efficiency, I developed this third-party SDK smart deployment tool.

Currently open source:https://github.com/DelphiTeacher/OrangeFreeSDK/tree/master/OrangeSDKSmartDeployment


1.Deploying documents is more convenient

  • Can deploy folders directly, instead of selecting the subfolders and files one by one.

For example, the Android Three-Party SDK for multi-select pictures I use has a res folder in it, and all sub-files in this folder must be deployed.

This tool can simply add the res folder to the deployment item,

Then click the “Preview” button to list all the files that need to be deployed

Select the project to be deployed, and then click “Process” to complete the deployment.

Look, the files in the res folder have been deployed, and they have been deployed to both Android and Android64 platforms at the same time.

    • When deploying files, you can directly select the commonly used remote directory RemotePath.

Such as StartUp\Documents\、.\assets\internal\、library\lib\armeabi-v7a\




2.Able to directly configure the permissions required by the SDK and Android components (such as activity, service, receiver, provider, etc.) to the project’s AndroidManifest.template.xml

  • Enter the Android permission list in the “Android permissions” memo, and enter the required Android components in the “Android components” memo

Click the “Process Permissions” and “Process Components” buttons on the right to configure them in the project

We can open the AndroidManifest.template.xml under the project directory to check:


3.Ability to directly add the JAR required by the SDK to the project.

Click “Add Android Jar”, select the Jar file you need to add,

Click the “Process Android Jar” button on the right to configure Jar to the project.

Let’s expand the Android->Libraries node of the project to check:


4.Aar package that can automatically configure Android easily

Click the “Add Android Aar” button to add the aar package,

Then click the “Process Android Aar” button on the right to configure aar into the project


Aar is a zip compressed package, which contains jar, resource files, so dynamic library, AndroidManifest.xml configuration, etc. My tool can decompress the aar compressed package, and configure the jar and res resource files in the project into the project, but AndroidManifest The configuration in .xml needs to be configured manually.


For example, the mediaselector-release.aar in the example, after clicking the “Process Android Aar” button, it will be decompressed to folder mediaselector-release_aar,

The content in it is as follows:

The tool will automatically configure this jar into the project,

The tool will also automatically deploy the res directory to the project,

But the permissions and Android components in AndroidManifest.xml in the aar package need to be manually configured to AndroidManifest.template.xml in the project directory

Another very important button is “Generate R.jar”.

Because aar needs to access the resource file according to the ID, otherwise an error will be reported, so this button is used to generate the ID of the resource file and package it into a jar. It is generated in the OrangeSDK_JarGen directory in the project directory. You need to manually add the jar Go to the project.


5.Can directly configure IOS link parameters for the project Options passed to the LD linker

If some third-party IOS SDKs need to configure link parameters, then enter them in the “Linker Options” on the “IOS Framework” page, and click the “Process IOS Linker Options” on the right to directly configure them in the project.


6.Can directly add commonly used Frameworks to the IOS SDK, such as SystemConfiguration, CoreTelephony, etc.

  • “Add Frameworks below to All iPhone SDKS” button. After clicking this button, the frameworks in the list box will be added to Delphi’s IOS SDK, because adding one by one is too time-consuming. After clicking this, you need to restart the IDE and click “Update Local File Cache” in the SDK Manager to complete the configuration.
  • “Add Dylibs below to All iPhone SDKs”按钮,这个功能和上面这个功能类似。



7.Set project icon and launch screen

As long as you select an icon, you can generate icons of various sizes, and you can set them all at once, no need to select one by one.


8.All configuration items can be saved to the configuration file, which is convenient for direct use next time.





  1. 布署文件更加方便
    1. 能直接布署文件夹,而不用一个个选择里面的子文件夹和文件。






    1. 布署文件时可以直接选择常用的远程目录RemotePath。


  1. 能够直接将SDK所需的权限和Android元件(比如activity、service、receiver、provider等)配置到工程的AndroidManifest.template.xml。
    1. 在安卓权限框中输入安卓权限列表,在安卓组件框中输入需要的安卓组件



  1. 能够直接将SDK所需的JAR添加到工程。

点击“Add Android Jar”,选择所需要添加的Jar文件,

点击右边的“Process Android Jar”按钮,即可将Jar配置到工程中去。


  1. 能够简单的自动配置Android的Aar包

点击“Add Android Aar”按钮来添加aar包,

再点击右边的“Process Android Aar”按钮来将aar配置到工程中


比如示例中的这个mediaselector-release.aar,点击了“Process Android Aar”按钮之后,会将它解压到mediaselector-release_aar,





另外一个很重要的按钮是“Generate R.jar”。


  1. 能够直接给工程配置IOS的链接参数Options passed to the LD linker

如果一些三方IOS SDK需要配置链接参数,那么就在“IOS Framework”页面中的”Linker Options”中输入好,点击右边的“Process IOS Linker Options”即可直接配置到工程中去。

  1. 能够直接给IOS SDK添加常用的Framework,比如SystemConfiguration、CoreTelephony等。

    1. “Add Frameworks below to All iPhone SDKS”按钮,点击了这个按钮之后,会将列表框中的framework添加到Delphi的IOS SDK中,因为一个个添加太费时间了。点击了这个之后,需要重启IDE,并且在SDK Manager中点击“Update Local File Cache”才算配置完。
    2. “Add Dylibs below to All iPhone SDKs”按钮,这个功能和上面这个功能类似。
  1. 设置工程图标和启动图片


  1. 所有的配置项都能保存到配置文件中,方便下次直接使用。
  2. 选择工程文件,勾选所需要的SDK(支付宝支付),进行一次性配置,并且将该工程所需要的SDK保存起来,下次重建工程的时候,再次重新配置即可