嗨,我在三星 skyrocket s2 (SGH-I727) 上从 Android 版本 2.3.5 升级到 2.3.6 时在 addTab 上收到此错误。但是,我的朋友有 2.3.6 版的三星 s2 (SGH-I777),它工作正常。模拟器工作正常。关于这个问题的任何想法?
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): java.lang.SecurityException: Requesting code from com.ifs.s.activity (with uid 10179)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.app.ActivityThread.getPackageInfo(ActivityThread.java:1296)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1546)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.app.ActivityThread.startActivityNow(ActivityThread.java:1491)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:691)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.widget.TabHost.setCurrentTab(TabHost.java:341)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.widget.TabHost.addTab(TabHost.java:226)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at com.ifs.s.view.MainTabView.populateTabs(MainTabView.java:79)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at com.ifs.s.view.MainTabView.onAttachedToWindow(MainTabView.java:73)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.view.View.dispatchAttachedToWindow(View.java:6309)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1122)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1127)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1127)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.view.ViewRoot.performTraversals(ViewRoot.java:854)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.view.ViewRoot.handleMessage(ViewRoot.java:1949)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.os.Handler.dispatchMessage(Handler.java:99)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.os.Looper.loop(Looper.java:130)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at android.app.ActivityThread.main(ActivityThread.java:3691)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at java.lang.reflect.Method.invoke(Method.java:507)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
05-01 15:24:34.625: E/com.ifs.s.view.MainTabView(21297): at dalvik.system.NativeStart.main(Native Method)
05-01 15:24:34.665: D/CLIPBOARD(21297): Hide Clipboard dialog at Starting input: finished by someone else... !
我们将其缩小到 DefaultHttpClient() 给出的问题。下面的代码,有什么想法吗?
protected HttpClient createClient() {
return new DefaultHttpClient();
}
HttpClient createHttpClient() {
try {
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
trustStore.load(null, null);
SSLSocketFactory sf = new AllowAllSSLSocketFactory(trustStore);
sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme(HTTP_PROTOCOL, PlainSocketFactory.getSocketFactory(), 80));
registry.register(new Scheme(HTTPS_PROTOCOL, sf, 443));
ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
return createClient(params, ccm);
}
catch (Exception e) {
return createClient();
}
}