【发布时间】:2018-03-21 06:40:59
【问题描述】:
请检查以下代码
package com.firebaseio.httpsfirbasenosql.auth;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
public class AuthClass {
public static void callAuth(Context con, String url) {
boolean isAppInstalled = appInstalledOrNot(con,"com.android.chrome");
if(isAppInstalled) {
Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(url));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.android.chrome");
try {
con.startActivity(intent);
} catch (ActivityNotFoundException ex) {
// Chrome browser presumably not installed so allow user to choose instead
// Log.i("Auth","ActivityNotFoundException");
intent.setPackage(null);
con.startActivity(intent);
}
} else {
// Log.i("Auth","Application is not currently installed.");
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
con.startActivity(browserIntent);
}
}
private static boolean appInstalledOrNot(Context con, String uri) {
PackageManager pm = con.getPackageManager();
try {
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
}
return false;
}
}
从 Kony App 我用 2 个参数调用 callAuth 函数, 第一个参数是上下文和第二个字符串。
请帮助我如何从 kony 应用程序应用上下文或如何在 android 静态类中调用 kony 上下文。
【问题讨论】:
-
在你的
Application中使用private static Context mContext = HealthApplication.getInstance():public static HealthApplication getInstance() { if (null == instance) { instance = new HealthApplication(); } return instance; } -
我做了同样的事情,还创建了扩展应用程序的应用程序类。代码在 android 端运行,但是当我尝试从 kony 调用时,它给出异常
-
显示你的异常
-
意外的顶级异常:[exec-shell] [dx] com.android.dex.DexException:多个 dex 文件定义 Lcom/firebaseio/httpsfirbasenosql/authResult 从 3424.4KiB 压缩到 2315.2KiB 以保存1109.2KiB [exec-shell] [dx] 将 dex A (1527 defs/2788.7KiB) 与 dex B (4 defs/5.0KiB) 合并。 R/AuthClass; [exec-shell] [dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) [exec-shell] [dx] at
-
科尼给出了这个例外
标签: android ffi temenos-quantum