I am unable to start activity ComponentInfo [duplicate] - android

This question already has answers here:
After Google Play Service update to version 13 I got an error
(8 answers)
Closed 9 years ago.
my app crashes on line
setContentView(R.layout.activity_map);
I'm using google maps api v2, i used to run this app on former eclipse and android sdk and it worked, after reinstallation of android sdk, got this exception
11-20 16:26:28.494: E/AndroidRuntime(19705): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.poputkaonline/com.example.poputkaonline.MapActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.access$600(ActivityThread.java:151)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.os.Looper.loop(Looper.java:155)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.main(ActivityThread.java:5520)
11-20 16:26:28.494: E/AndroidRuntime(19705): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 16:26:28.494: E/AndroidRuntime(19705): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
11-20 16:26:28.494: E/AndroidRuntime(19705): at dalvik.system.NativeStart.main(Native Method)
11-20 16:26:28.494: E/AndroidRuntime(19705): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:324)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.Activity.setContentView(Activity.java:1912)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.example.poputkaonline.MapActivity.onCreate(MapActivity.java:263)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.Activity.performCreate(Activity.java:5066)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2311)
11-20 16:26:28.494: E/AndroidRuntime(19705): ... 11 more
11-20 16:26:28.494: E/AndroidRuntime(19705): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:269)
11-20 16:26:28.494: E/AndroidRuntime(19705): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)

try to add Google play service as reference to your project...
and even add in androidmanifest.xml
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

The explanation lies within your stacktrace:
Caused by: java.lang.IllegalStateException: The meta-data tag in your
app's AndroidManifest.xml does not have the right value. Expected
4030500 but found 0. You must have the following declaration within
the <application> element: <meta-data android:name="com.google.android.gms.version"android:value="#integer/google_play_services_version" />

Related

Ionic Framework start error on Android

I have a project with Ionic working fine in iOS (emulator and device), web and with a problem in Android.
I have used to create the project:
ionic platform add android
I open the project with Eclipse, everything is Ok, no errors, and CordovaLib is loading fine.
When I try to deploy in my device, I have this error:
11-20 15:22:56.350: E/AndroidRuntime(10312): FATAL EXCEPTION: main
11-20 15:22:56.350: E/AndroidRuntime(10312): Process: com.ionicframework.congressapp251163, PID: 10312
11-20 15:22:56.350: E/AndroidRuntime(10312): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ionicframework.congressapp251163/com.ionicframework.congressapp251163.CordovaApp}: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2447)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2507)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.access$900(ActivityThread.java:172)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.os.Looper.loop(Looper.java:146)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.main(ActivityThread.java:5692)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): at java.lang.reflect.Method.invoke(Method.java:515)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
11-20 15:22:56.350: E/AndroidRuntime(10312): at dalvik.system.NativeStart.main(Native Method)
11-20 15:22:56.350: E/AndroidRuntime(10312): Caused by: java.lang.NullPointerException
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.getPlugin(PluginManager.java:191)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.startupPlugins(PluginManager.java:114)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.PluginManager.init(PluginManager.java:92)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:383)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:368)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:344)
11-20 15:22:56.350: E/AndroidRuntime(10312): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:389)
11-20 15:22:56.350: E/AndroidRuntime(10312): at com.ionicframework.congressapp251163.CordovaApp.onCreate(CordovaApp.java:33)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Activity.performCreate(Activity.java:5541)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
11-20 15:22:56.350: E/AndroidRuntime(10312): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
11-20 15:22:56.350: E/AndroidRuntime(10312): ... 11 more
EDIT:
The plugins have not been copying to the Android Project :(
Help please ;) Thanks!!
I had the same problem,but solved using this way.After creating the project first I build the project using the command ionic build android, then import it.if its not working try this
1.Remove the platform using ionic platform remove android
2.Add the platform again,and run.

When i use Google Map Api v2 for map then i can't add google play service library

I want to show current location in map using Google Map v2. I create sha key and generate API key and also integrate with androidmanifest.xml. I download example of following link:
http://wptrafficanalyzer.in/blog/showing-current-location-in-google-maps-using-api-v2-with-supportmapfragment/
I also give internet permission and other but in my log-cat following error display.
11-20 11:09:59.190: E/dalvikvm(719): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method in.wptrafficanalyzer.locationingooglemapv2.MainActivity.onLocationChanged
11-20 11:09:59.190: W/dalvikvm(719): VFY: unable to resolve new-instance 460 (Lcom/google/android/gms/maps/model/LatLng;) in Lin/wptrafficanalyzer/locationingooglemapv2/MainActivity;
11-20 11:09:59.190: D/dalvikvm(719): VFY: replacing opcode 0x22 at 0x0010
11-20 11:09:59.220: D/dalvikvm(719): DexOpt: unable to opt direct call 0x0cdc at 0x12 in Lin/wptrafficanalyzer/locationingooglemapv2/MainActivity;.onLocationChanged
11-20 11:09:59.482: D/AndroidRuntime(719): Shutting down VM
11-20 11:09:59.482: W/dalvikvm(719): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
11-20 11:09:59.501: E/AndroidRuntime(719): FATAL EXCEPTION: main
11-20 11:09:59.501: E/AndroidRuntime(719): java.lang.RuntimeException: Unable to start activity ComponentInfo{in.wptrafficanalyzer.locationingooglemapv2/in.wptrafficanalyzer.locationingooglemapv2.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class fragment
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.ActivityThread.access$600(ActivityThread.java:130)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.os.Looper.loop(Looper.java:137)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-20 11:09:59.501: E/AndroidRuntime(719): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 11:09:59.501: E/AndroidRuntime(719): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 11:09:59.501: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-20 11:09:59.501: E/AndroidRuntime(719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-20 11:09:59.501: E/AndroidRuntime(719): at dalvik.system.NativeStart.main(Native Method)
11-20 11:09:59.501: E/AndroidRuntime(719): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class fragment
11-20 11:09:59.501: E/AndroidRuntime(719): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-20 11:09:59.501: E/AndroidRuntime(719): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.Activity.setContentView(Activity.java:1867)
11-20 11:09:59.501: E/AndroidRuntime(719): at in.wptrafficanalyzer.locationingooglemapv2.MainActivity.onCreate(MainActivity.java:27)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.Activity.performCreate(Activity.java:5008)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
11-20 11:09:59.501: E/AndroidRuntime(719): ... 11 more
11-20 11:09:59.501: E/AndroidRuntime(719): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public
11-20 11:09:59.501: E/AndroidRuntime(719): at android.support.v4.app.Fragment.instantiate(Fragment.java:401)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
11-20 11:09:59.501: E/AndroidRuntime(719): ... 21 more
11-20 11:09:59.501: E/AndroidRuntime(719): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.maps.SupportMapFragment
11-20 11:09:59.501: E/AndroidRuntime(719): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
11-20 11:09:59.501: E/AndroidRuntime(719): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
11-20 11:09:59.501: E/AndroidRuntime(719): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
11-20 11:09:59.501: E/AndroidRuntime(719): at android.support.v4.app.Fragment.instantiate(Fragment.java:391)
11-20 11:09:59.501: E/AndroidRuntime(719): ... 24 more
Now what i can do for displaying map?
Maps Activity
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="YourPackageName"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="YourPackageName.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="YourPackageName.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="YourPackageName.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="4030500" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YourKey" />
</application>`enter code here`
</manifest>
Open sdk manager and download google play service under extras, you will get two libraries google-play-services_lib.jar and google-play-services.jar. You can find these libraries under google play service in extras. You have to copy these two libraries and paste under lib folder in your app and also add these libraries under java Build path.
make sure by going to google api console go to services in go down you will find google map v2 eanble it...
To add a reference to a library project, follow these steps:
1. Make sure that both the project library and the application project that depends on it are in your workspace. If one of the projects is missing, import it into your workspace.
2. In the Package Explorer, right-click the dependent project and select Properties.
3.In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
4.Click Add to open the Project Selection dialog.
5.From the list of available library projects, select a project and click OK.
6.When the dialog closes, click Apply in the Properties window.
7.Click OK to close the Properties window.
how to add reference Google play Library
Android Library Projects

AsyncHttpClient ConnectException with no error message

I have a problem but could not be found any solution, I use AsyncHttpClient in https://github.com/AsyncHttpClient/async-http-client, I can run my code in API level 10, but not in API level 17. I am getting this error:
11-13 14:36:47.987 13294-13294/com.modilisim.antalyaticaretborsasi E/com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment﹕ error occurred while getting daily bultenler
java.util.concurrent.ExecutionException: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyResponseFuture.abort(NettyResponseFuture.java:328)
at com.ning.http.client.providers.netty.NettyConnectListener.operationComplete(NettyConnectListener.java:106)
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427)
at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.doConnect(NettyAsyncHttpProvider.java:1056)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:880)
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:521)
at com.ning.http.client.AsyncHttpClient$BoundRequestBuilder.execute(AsyncHttpClient.java:238)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:126)
at com.modilisim.antalyaticaretborsasi.presenter.BultenPresenter.getDailyBultenler(BultenPresenter.java:102)
at com.modilisim.antalyaticaretborsasi.view.fragment.ScrollingBultenlerFragment.onCreateView(ScrollingBultenlerFragment.java:51)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:291)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at com.modilisim.antalyaticaretborsasi.view.fragment.MainFragment.onCreateView(MainFragment.java:42)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
at android.app.Activity.performStart(Activity.java:5114)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2356)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5195)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.net.ConnectException: http://...
at com.ning.http.client.providers.netty.NettyConnectListener.operationCom
I am doing a project in a company so I had to hide the urls in the error code above, but urls are working, they are not problem. Any help appreciated, thanks.
I learned that this AsyncHttpClient library is not for Android, so it is not working properly on all versions of Android. There is a library parallel to this library for Android: http://loopj.com/android-async-http/

loading activities from external dex/jar files

I have a lib.apk that is sent by server and received by my application and then saved on sdcard.now I want run activities of inside my library but when I try do it, it gives me error do you define activity in manifest. I added activity tag to manifest of my lib but it still didn't work. Can anyone give any idea?
manifest file of my lib
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lib"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.lib.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
logcat error
11-20 05:16:49.918: W/System.err(6721): java.lang.reflect.InvocationTargetException
11-20 05:16:49.938: W/System.err(6721): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 05:16:49.948: W/System.err(6721): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 05:16:49.948: W/System.err(6721): at com.example.myapp2.MainActivity.onCreate(MainActivity.java:29)
11-20 05:16:49.948: W/System.err(6721): at android.app.Activity.performCreate(Activity.java:5104)
11-20 05:16:49.948: W/System.err(6721): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
11-20 05:16:49.948: W/System.err(6721): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
11-20 05:16:49.958: W/System.err(6721): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
11-20 05:16:49.958: W/System.err(6721): at android.app.ActivityThread.access$600(ActivityThread.java:141)
11-20 05:16:49.958: W/System.err(6721): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
11-20 05:16:49.958: W/System.err(6721): at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 05:16:49.969: W/System.err(6721): at android.os.Looper.loop(Looper.java:137)
11-20 05:16:49.969: W/System.err(6721): at android.app.ActivityThread.main(ActivityThread.java:5041)
11-20 05:16:49.969: W/System.err(6721): at java.lang.reflect.Method.invokeNative(Native Method)
11-20 05:16:49.969: W/System.err(6721): at java.lang.reflect.Method.invoke(Method.java:511)
11-20 05:16:49.969: W/System.err(6721): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-20 05:16:49.978: W/System.err(6721): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
11-20 05:16:49.978: W/System.err(6721): at dalvik.system.NativeStart.main(Native Method)
11-20 05:16:49.978: W/System.err(6721): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.myapp2/com.example.lib.MainActivity}; have you declared this activity in your AndroidManifest.xml?
11-20 05:16:49.988: W/System.err(6721): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
11-20 05:16:50.000: W/System.err(6721): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
11-20 05:16:50.008: W/System.err(6721): at android.app.Activity.startActivityForResult(Activity.java:3370)
11-20 05:16:50.008: W/System.err(6721): at android.app.Activity.startActivityForResult(Activity.java:3331)
11-20 05:16:50.008: W/System.err(6721): at android.app.Activity.startActivity(Activity.java:3566)
11-20 05:16:50.019: W/System.err(6721): at android.app.Activity.startActivity(Activity.java:3534)
11-20 05:16:50.028: W/System.err(6721): at com.example.lib.Main.onCreate(Main.java:32)
You cannot run activties that have not been installed on the phone. Just having an APK on the SD-card is not enough. This APK will need to be installed on the device.

android google map v.2 : android.view.InflateException: Binary XML file line #739: Error inflating class fragment

I found similar topics in stackoverflow but it didn't help for me. I want to show map, but when i run it, it return force close. Here are the codes :
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
this is my layout :
<fragment
android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="300dp"
android:layout_margin="20dp"
class="com.google.android.gms.maps.MapFragment" />
this is my manifest :
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY_API_KEY" />
</application>
this my logcat :
11-13 16:03:10.652: E/AndroidRuntime(32202): FATAL EXCEPTION: main
11-13 16:03:10.652: E/AndroidRuntime(32202): java.lang.RuntimeException: Unable to start activity ComponentInfo{id.go.kpp.aplikasipupi/id.go.kpp.aplikasipupi.kartu}: android.view.InflateException: Binary XML file line #739: Error inflating class fragment
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.access$600(ActivityThread.java:140)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.os.Handler.dispatchMessage(Handler.java:99)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.os.Looper.loop(Looper.java:137)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.main(ActivityThread.java:4895)
11-13 16:03:10.652: E/AndroidRuntime(32202): at java.lang.reflect.Method.invokeNative(Native Method)
11-13 16:03:10.652: E/AndroidRuntime(32202): at java.lang.reflect.Method.invoke(Method.java:511)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
11-13 16:03:10.652: E/AndroidRuntime(32202): at dalvik.system.NativeStart.main(Native Method)
11-13 16:03:10.652: E/AndroidRuntime(32202): Caused by: android.view.InflateException: Binary XML file line #739: Error inflating class fragment
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:306)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.setContentView(Activity.java:1912)
11-13 16:03:10.652: E/AndroidRuntime(32202): at id.go.kpp.aplikasipupi.kartu.onCreate(kartu.java:100)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.performCreate(Activity.java:5163)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
11-13 16:03:10.652: E/AndroidRuntime(32202): ... 11 more
11-13 16:03:10.652: E/AndroidRuntime(32202): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.app.Activity.onCreateView(Activity.java:4813)
11-13 16:03:10.652: E/AndroidRuntime(32202): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-13 16:03:10.652: E/AndroidRuntime(32202): ... 24 more
i don't know why it still error, i hope somebody can help me to solve my problem.
The logcat is clear
You need to add the below to manifest file
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
https://developers.google.com/maps/documentation/android/start#add_the_google_play_services_version_to_your_apps_manifest
Edit your application's AndroidManifest.xml file, and add the following declaration within the <application> element. This embeds the version of Google Play services that the app was compiled with.
I got the same exception as well, but I figured out for Google API v2 to work, you must include these permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
I hope this will help you guys.
P.S I used these permissions for adding a simple map in my app. There are certain other permissions which this link suggests as well.

Categories

Resources