我开发了一个适用于android应用程序的SDK。我们有许多客户端在那里使用这个SDK的应用程序。现在我已经更新了我的SDK。我正在寻找一种方式,这些更改可以反映在那里的应用程序没有更新那里的应用程序在商店store.Urgent帮助needed.Any帮助将不胜感激。提前感谢。推出更新的SDK OTA
7
A
回答
4
那么你可以动态使用DexLoader类...你可以当过你want..on存储...以下是工作代码更新您的SD卡装入一个jar文件..
final String libPath = Environment.getExternalStorageDirectory() + "/test.jar";
final File tmpDir = getDir("dex", 0);
final DexClassLoader classloader = new DexClassLoader(libPath, tmpDir.getAbsolutePath(), null, this.getClass().getClassLoader());
final Class<Object> classToLoad = (Class<Object>) classloader.loadClass("com.test.android.MainActivity");
final Object myInstance = classToLoad.newInstance();
final Method doSomething = classToLoad.getMethod("doSomething");
doSomething.invoke(myInstance);
,并在你的库文件的代码可以是这样的
public class MainActivity {
public void doSomething() {
Log.e(MainActivity .class.getName(), "MainActivity : doSomething() called.");
}}
告诉我,如果你需要任何帮助
1
有没有这种方式适合您的情况。但有一件事你可以做,以启用它的下一次更新。 Android可以通过DexClassLoader动态加载编译后的代码。所以你编译一个新的DEX文件,然后强制你的SDK下载并使用它。
// Internal storage where the DexClassLoader writes the optimized dex file to
final File optimizedDexOutputPath = getDir("outdex", Context.MODE_PRIVATE);
DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(),
optimizedDexOutputPath.getAbsolutePath(),
null,
getClassLoader());
Class libProviderClazz = null;
try {
// Load the library.
libProviderClazz =
cl.loadClass("com.example.dex.lib.LibraryProvider");
// Cast the return object to the library interface so that the
// caller can directly invoke methods in the interface.
// Alternatively, the caller can invoke methods through reflection,
// which is more verbose.
LibraryInterface lib = (LibraryInterface) libProviderClazz.newInstance();
lib.showAwesomeToast(this, "hello");
} catch (Exception e) { ... }
相关问题
- 1. 更新应用程序OTA
- 2. 用BLE113 OTA固件更新
- 3. Facebook Api(新推出)(IN ANDROID SDK)
- 4. 企业OTA应用程序更新
- 5. IPhone SDK:推出再次
- 6. 更新SDK包
- 7. 更新Android SDK后出错22.0.1
- 8. 的Android SDK的推出悬挂装置
- 9. iPhone OTA给出错误
- 10. 推出iOS屏幕不更新
- 11. 更新的SDK,无法更新adt
- 12. 更新Azure Web Jobs SDK更新后出错
- 13. 将SDK升级到更新的SDK
- 14. 三星Galaxy TAb的意图一个软件更新(Android OTA)
- 15. 适用于Android的Web服务器固件OTA更新
- 16. 苹果是否允许应用程序的OTA更新
- 17. SDK更新失败
- 18. 更新SDK版本
- 19. SDK实时更新
- 20. 测试航班SDK在ios中更新但不推荐使用
- 21. 更新TwitterKit SDK中的iOS
- 22. 更新sdk后的错误
- 23. 的Android SDK更新接触
- 24. ADB更新出厂设置?
- 25. 推出新功能
- 26. Listpreference推出新的活动
- 27. iPhone OTA分销
- 28. iOS应用程序未通过OTA Enterprise Distribution正确更新
- 29. 应用程序是否可以更新OTA
- 30. 在Android源代码中,系统查找并下载OTA更新?
你能认罪再解释一下。我的意思是在哪里以及如何实现这些代码以及流程将如何实现。将这项工作通过空气?预先感谢。 – Scorpio
@HarrySharma,https://www.google.com.ua/webhp?sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8#q=android%20dexclassloader%20example&es_th=1 –