18Android,GitHub - mmin18/AndroidDynamicLoader: A plugin system that runs like a browser, but instea...

Android Dynamic Loader

Android Dynamic Loader is a plugin system. The host application is like a browser, but instead of load web pages, it load plugins which runs natively on Android system.

a7817af91c292a349c9b2f8c91b52e19.png

61a0840008a3bd15161f886426a7e4ea.png

How to run the sample plugins

The sample plugins is under workspace folder, but do not try to run them directly, it won't start.

First you need to install host.apk on your phone (or you can build the Host project yourself)

Also you need to make sure the Android SDK and Ant is installed and android-sdk/tools, android-sdk/platform-tools, ant is in your PATH.

Run the following commands:

chmod +x tools/update.sh

tools/update.sh workspace

cd workspace

ant run

If it shows "device not found", make sure your phone is connected or simulator is running. "adb devices" will tell.

Since we don't specific a default entry in workspace.properties, it will popup a window and let you choose one. I suggest bitmapfun.

About UI Container

In a normal Android application, we use Activity as the root UI container. But since Activity is registered in AndroidManifest.xml, and we can't modify manifest in runtime, we must find an alternative UI container - Fragment.

The Fragment itself, introduced in Android 3.0 Honeycomb, is a perfect UI container, and it has lifecycle and state management.

Once the plugin and its dependency is downloaded, an Activity (MainActivity.java) will be started, create an instance of the specific fragment, and add the fragment into the root view.

About URL Mapping

Since we use Fragment as UI container, each page is implemented in Fragment instead of Activity. So how do we start a new page?

We use URL, just like a browser does. For instance, in a browser, we open http://mydomain.com/helloworld.html. In plugins, we open app://helloworld.

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("app://helloworld"));

startActivity(i);

Each host is mapped to a single fragment, you define the url mapping table in project/fragment.properties.

About Resources

In the plugins, we pack resources and codes in the same package. We use R.java as the index of resources.

But instead of using context.getResources(), we use MyResources.getResource(Me.class) to get the resources which in the same package as Me.class.

Here is a sample in HelloFragment.java

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

// MyResources manages the resources in specific package.

// Using a Class object to obtain an instance of MyResources.

// In this case, hello.xml is in the same package as HelloFragment class

MyResources res = MyResources.getResource(HelloFragment.class);

// Using MyResources.inflate() if you want to inflate some layout in

// this package.

return res.inflate(getActivity(), R.layout.hello, container, false);

}

You can use MyResources to get drawable, string, or inflate layout.

Folders

/Host contains the host application (build as host.apk).

/tools/update.sh checks your environment and helps you config your plugins. You should always run it once after git clone or create a new plugin.

/workspace/sample.helloworld is a most simple plugin.

/workspace/sample.helloworld/fragment.properties defines the url mapping of your fragments.

/site/***/site.txt is the definition file for all the plugins files, dependency and fragments url mapping table.

这个错误提示表示 Git 无法访问 `https://github.com/25xiaoyuan/ALL-SEASONS-job-recruitment-system.git/`,可能是因为网络连接被重置或者存在其他网络问题。这种情况下,你可以尝试以下几种解决方法: 1. 检查网络连接是否正常。可以尝试访问其他网站或者使用其他网络连接方式,例如切换到 Wi-Fi 网络或者使用移动数据网络。 2. 检查仓库地址是否正确。确保你输入的仓库地址是正确的,没有拼写错误或者其他错误。 3. 检查仓库权限是否正确。如果你没有权限访问这个仓库或者进行推送操作,那么 Git 会拒绝你的请求。可以联系仓库管理员或者查看仓库的文档和说明,了解如何获取权限。 4. 尝试使用 SSH 协议进行访问。如果你遇到了 HTTPS 访问的问题,可以尝试使用 SSH 协议进行访问。具体步骤如下: - 生成 SSH 密钥。可以使用 `ssh-keygen` 命令生成 SSH 密钥对。执行命令时,可以选择默认设置或者按照提示进行设置。 ``` ssh-keygen ``` - 将公钥添加到 GitHub 账户中。可以将公钥内容复制到 GitHub 账户的 SSH Key 配置中,具体步骤可以参考 GitHub 的文档。 - 修改仓库地址。将仓库地址从 `https://github.com/25xiaoyuan/ALL-SEASONS-job-recruitment-system.git/` 修改为 `git@github.com:25xiaoyuan/ALL-SEASONS-job-recruitment-system.git`,即使用 SSH 协议的地址。 ``` git remote set-url origin git@github.com:25xiaoyuan/ALL-SEASONS-job-recruitment-system.git ``` - 尝试推送修改。使用 `git push` 命令尝试推送修改。 ``` git push origin master ``` 注意,使用 SSH 协议进行访问需要在本地配置 SSH 密钥,并且需要在 GitHub 账户中添加公钥。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值