我在2.2环境中完成了我的应用程序,当我在旧版本中安装我的apk时,我得到解析器错误。是否有可能显示我们自己的消息而不是解析器错误消息。根据我的观点,事实并非如此。
答案 0 :(得分:1)
做这样的事情
private int GetVersion()
{
int version = 0;
IPackageManager pm = ActivityThread.getPackageManager();
try
{
//returns a ref to my application according to its application name
ApplicationInfo applicationInfo = pm.getApplicationInfo("com.android.phonetests", 0);
if (applicationInfo != null)
{
version = applicationInfo.targetSdkVersion;
//2 is 5
//2.01 6 (Donut - 2.01)
//2.2 7 (Eclair - 2.2) currently it is Eclair_MR1 (Major Release)
switch (version)
{
case Build.VERSION_CODES.ECLAIR_MR1:
Log.i(LOG_TAG,"[DBG] version: ECLAIR");//2.2 7 (Eclair - 2.2) currently it is Eclair_MR1 (Major Release)
break;
case Build.VERSION_CODES.DONUT:
Log.i(LOG_TAG,"[DBG] version: DONUT");//2.01 6 (Donut - 2.01)
break;
}
}
}
catch (android.os.RemoteException e){}
return version;
}
答案 1 :(得分:0)
据我所知,你为2.2版本构建,然后在早期版本上部署它。为什么不为早期版本构建它?
我认为你不会得到另一个错误而不是解析错误。