Google Maps Android V2: Failed to load maps module - android

I'm developing an application that makes use of the Google Maps API. However, when I run the application on an emulator, I get the following error: "Failed to load map module."
I made sure I checked "Google Maps API For Android" from the Developer's Console. The following are my configurations:
Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="MYPACKAGE">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<permission android:name="MYPACKAGE.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="MY_API_KEY"/>
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Where MY_API_KEY is the actual API key I received from Google.
activity_main.xml:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="MYPACKAGE.MainActivity" />
MainActivity.java:
package MYPACKAGE;
import android.graphics.Color;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.Circle;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MainActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
The LogCat shows me the following when I attempt to run the code:
02-12 03:57:57.370 1261-1261/? D/dalvikvm: Not late-enabling CheckJNI (already on)
02-12 03:57:59.030 1261-1261/com.be2015.meetupmap I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
02-12 03:57:59.040 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve virtual method 240: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
02-12 03:57:59.040 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x6e at 0x00c8
02-12 03:57:59.090 1261-1261/com.be2015.meetupmap I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzh
02-12 03:57:59.090 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve virtual method 542: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
02-12 03:57:59.100 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x6e at 0x000b
02-12 03:57:59.520 1261-1293/com.be2015.meetupmap I/GMPM: App measurement is starting up
02-12 03:57:59.680 1261-1293/com.be2015.meetupmap E/GMPM: getGoogleAppId failed with status: 10
02-12 03:57:59.700 1261-1293/com.be2015.meetupmap E/GMPM: Uploading is not possible. App measurement disabled
02-12 03:58:00.240 1261-1261/com.be2015.meetupmap D/dalvikvm: GC_FOR_ALLOC freed 338K, 12% free 3048K/3452K, paused 171ms, total 213ms
02-12 03:58:00.250 1261-1261/com.be2015.meetupmap I/zzy: Making Creator dynamically
02-12 03:58:01.520 1261-1261/com.be2015.meetupmap I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.mz.b
02-12 03:58:01.520 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve virtual method 141: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
02-12 03:58:01.520 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x6e at 0x00ce
02-12 03:58:01.530 1261-1261/com.be2015.meetupmap I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.nb.a
02-12 03:58:01.530 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve virtual method 424: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
02-12 03:58:01.530 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x6e at 0x000d
02-12 03:58:01.630 1261-1261/com.be2015.meetupmap D/ChimeraCfgMgr: Reading stored module config
02-12 03:58:01.680 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Failed to load module: module id not found
02-12 03:58:01.680 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Attempt 1 failed.
02-12 03:58:02.270 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Failed to load module: module id not found
02-12 03:58:02.270 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Attempt 2 failed.
02-12 03:58:02.370 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Failed to load module: module id not found
02-12 03:58:02.370 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Attempt 3 failed.
02-12 03:58:02.420 1261-1261/com.be2015.meetupmap D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
02-12 03:58:02.430 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve static field 119 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
02-12 03:58:02.440 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x62 at 0x0012
02-12 03:58:02.440 1261-1261/com.be2015.meetupmap D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_32_BIT_ABIS
02-12 03:58:02.450 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve static field 118 (SUPPORTED_32_BIT_ABIS) in Landroid/os/Build;
02-12 03:58:02.450 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x62 at 0x0021
02-12 03:58:02.470 1261-1261/com.be2015.meetupmap D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
02-12 03:58:02.470 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve static field 119 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
02-12 03:58:02.470 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x62 at 0x0008
02-12 03:58:02.470 1261-1261/com.be2015.meetupmap D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_ABIS
02-12 03:58:02.480 1261-1261/com.be2015.meetupmap W/dalvikvm: VFY: unable to resolve static field 120 (SUPPORTED_ABIS) in Landroid/os/Build;
02-12 03:58:02.480 1261-1261/com.be2015.meetupmap D/dalvikvm: VFY: replacing opcode 0x62 at 0x0008
02-12 03:58:02.480 1261-1261/com.be2015.meetupmap W/DynamiteUtils: Client module failure reason: 11
02-12 03:58:02.510 1261-1261/com.be2015.meetupmap D/maps.CreatorImpl: Module could not be loaded.
02-12 03:58:02.570 1261-1261/com.be2015.meetupmap D/maps.CreatorImpl: Failed to load maps module.
android.os.RemoteException
at com.google.android.gms.maps.internal.CreatorImpl.a(SourceFile:76)
at com.google.android.gms.maps.internal.CreatorImpl.b(SourceFile:96)
at com.google.android.gms.maps.internal.ag.onTransact(SourceFile:62)
at android.os.Binder.transact(Binder.java:361)
at com.google.android.gms.maps.internal.zzc$zza$zza.zzt(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzzh(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onInflate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
at android.support.v4.app.Fragment.onInflate(Fragment.java:1129)
at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2283)
at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:111)
at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:314)
at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at com.be2015.meetupmap.MainActivity.onCreate(MainActivity.java:23)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
02-12 03:58:03.310 1261-1261/com.be2015.meetupmap W/EGL_emulation: eglSurfaceAttrib not implemented
02-12 03:58:03.350 1261-1261/com.be2015.meetupmap D/OpenGLRenderer: Enabling debug mode 0
Can anyone tell me what's going wrong? I have absolutely no idea!

Maybe this is your problem?!
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
Log.i(TAG, "This device is not supported.");
finish();
}
}
Android - Google Map v2 - need update google play service on device

Related

Error while trying to run admob ad on Android Studio

I am trying to install an admob ad on my webview app that I developed with Android Studio but the app keeps crashing now and I can't seem to get the code right.... everywhere I read about the Android SDK is different information....
This is the error I keep getting and I can't seem to figure out why I am getting it..
03-17 02:31:31.637 15034-15034/? I/SELinux: Function: selinux_android_load_priority [0], There is no sepolicy file.
03-17 02:31:31.697 15034-15034/? I/SELinux: Function: selinux_android_load_priority , spota verifySig and checkHash pass. priority version is VE=SEPF_SGH-I527M_4.4.2_0046
03-17 02:31:31.697 15034-15034/? I/SELinux: selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts
03-17 02:31:31.697 15034-15034/? D/dalvikvm: Late-enabling CheckJNI
03-17 02:31:32.127 15034-15034/com.payforlikes.app.payforlikes I/dalvikvm-heap: Grow heap (frag case) to 23.093MB for 14791732-byte allocation
03-17 02:31:32.278 15034-15034/com.payforlikes.app.payforlikes I/Adreno-EGL: <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: (CL3869936) OpenGL ES Shader Compiler Version: 17.01.12.SPL Build Date: 03/03/14 Mon Local Branch: default Remote Branch: Local Patches: Reconstruct Branch:
03-17 02:31:32.428 15034-15034/com.payforlikes.app.payforlikes D/OpenGLRenderer: Enabling debug mode 0
03-17 02:31:33.339 15034-15034/com.payforlikes.app.payforlikes E/OpenGLRenderer: SFEffectCache:clear(), mSize = 0
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: VFY: unable to resolve interface method 19659: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;)V
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: VFY: unable to resolve interface method 19661: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: VFY: unable to resolve interface method 19665: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: VFY: unable to resolve virtual method 545: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: VFY: unable to resolve virtual method 567: Landroid/content/res/TypedArray;.getType (I)I
03-17 02:31:35.271 15034-15034/com.payforlikes.app.payforlikes D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
03-17 02:31:35.351 15034-15034/com.payforlikes.app.payforlikes V/WebViewChromium: Binding Chromium to the background looper Looper (main, tid 1) {41ea0198}
03-17 02:31:35.391 15034-15034/com.payforlikes.app.payforlikes I/chromium: [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
03-17 02:31:35.391 15034-15034/com.payforlikes.app.payforlikes I/BrowserProcessMain: Initializing chromium process, renderers=0
03-17 02:31:35.521 15034-15034/com.payforlikes.app.payforlikes I/Adreno-EGL: <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: (CL3869936) OpenGL ES Shader Compiler Version: 17.01.12.SPL Build Date: 03/03/14 Mon Local Branch: default Remote Branch: Local Patches: Reconstruct Branch:
03-17 02:31:35.531 15034-15257/com.payforlikes.app.payforlikes W/chromium: [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
03-17 02:31:35.731 15034-15034/com.payforlikes.app.payforlikes W/Ads: Required XML attribute "adSize" was missing.
03-17 02:31:35.992 15034-15034/com.payforlikes.app.payforlikes D/AndroidRuntime: Shutting down VM
03-17 02:31:35.992 15034-15034/com.payforlikes.app.payforlikes W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x416cdda0)
03-17 02:31:36.002 15034-15034/com.payforlikes.app.payforlikes E/AndroidRuntime: FATAL EXCEPTION: main Process: com.payforlikes.app.payforlikes, PID: 15034 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.payforlikes.app.payforlikes/com.payforlikes.app.payforlikes.MainActivity}: java.lang.IllegalStateException: The ad size and ad unit ID must be set before loadAd is called.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
at android.app.ActivityThread.access$900(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: The ad size and ad unit ID must be set before loadAd is called.
at com.google.android.gms.ads.internal.client.zzab.zzdg(Unknown Source)
at com.google.android.gms.ads.internal.client.zzab.zza(Unknown Source)
at com.google.android.gms.ads.BaseAdView.loadAd(Unknown Source)
at com.google.android.gms.ads.AdView.loadAd(Unknown Source)
at com.payforlikes.app.payforlikes.MainActivity.onCreate(MainActivity.java:55)
at android.app.Activity.performCreate(Activity.java:5451)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471) 
at android.app.ActivityThread.access$900(ActivityThread.java:175) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:146) 
at android.app.ActivityThread.main(ActivityThread.java:5602) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
at dalvik.system.NativeStart.main(Native Method) 
Here is my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.payforlikes.app.payforlikes.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.payforlikes.app.payforlikes"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.android.support:design:24.0.0-alpha1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
}
Here is my MainActivity.java
package com.payforlikes.app.payforlikes;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd; public class MainActivity extends AppCompatActivity {
InterstitialAd mInterstitialAd;
private InterstitialAd interstitial;
private static final String TEST_DEVICE_ID = "INSERT_YOUR_TEST_DEVICE_ID_HERE";
private WebView mWebView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
mWebView.setWebViewClient(new WebViewClient());
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("http://payforlikes.com/");
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// The "loadAdOnCreate" and "testDevices" XML attributes no longer available.
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice(TEST_DEVICE_ID)
.build();
adView.loadAd(adRequest);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void displayInterstitial() { // If Ads are loaded, show Interstitial else show nothing.
if (interstitial.isLoaded()) {
interstitial.show();
}
} }
Here is my content_main.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.payforlikes.app.payforlikes.MainActivity"
tools:showIn="#layout/activity_main">
<WebView
android:id="#+id/activity_main_webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.gms.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="INSERT_YOUR_AD_UNIT_ID_HERE"/> </RelativeLayout>
Here is my AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
package="com.payforlikes.app.payforlikes">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

Android Studio - Web View Error - No Such File or directory

I am using Andoid Studio to develop an app and while opening the app , I am not able to see my web page ,a white screen is coming. I saw the console and find this error
E/Trace﹕ error opening trace file: No such file or directory (2)
When I see my manifest file, its seems fine for me and also MainActivity.java seems good for me.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pe.com.bcp.creaapp" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Here is the java class
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import java.io.File;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView myWebView = (WebView) findViewById(R.id.myWebView);
//myWebView.getSettings().setJavaScriptEnabled(true);
String filePath = "file:///android_asset/Flickular-Demo-master/src/index.html";
myWebView.loadUrl(filePath);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
#Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
I do not understand why Its not showing and what I am missing ?
Activity Main Layout.
<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" android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin" tools:context=".MainActivity">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/myWebView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
Below is the log from Console :-
09-04 13:38:20.307 10194-10194/ D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
09-04 13:38:20.318 10194-10194/ E/Trace﹕ error opening trace file: No such file or directory (2)
09-04 13:38:20.327 10194-10194/ W/dalvikvm﹕ VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
09-04 13:38:20.327 10194-10194/ I/dalvikvm﹕ Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onSearchRequested
09-04 13:38:20.327 10194-10194/ W/dalvikvm﹕ VFY: unable to resolve interface method 14035: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
09-04 13:38:20.327 10194-10194/ D/dalvikvm﹕ VFY: replacing opcode 0x72 at 0x0002
09-04 13:38:20.327 10194-10194/ I/dalvikvm﹕ Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.internal.view.WindowCallbackWrapper.onWindowStartingActionMode
09-04 13:38:20.327 10194-10194/ W/dalvikvm﹕ VFY: unable to resolve interface method 14039: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
09-04 13:38:20.327 10194-10194/ D/dalvikvm﹕ VFY: replacing opcode 0x72 at 0x0002
09-04 13:38:20.327 10194-10194/ I/dalvikvm﹕ Could not find method android.view.ViewGroup.onRtlPropertiesChanged, referenced from method android.support.v7.widget.Toolbar.onRtlPropertiesChanged
09-04 13:38:20.327 10194-10194/ W/dalvikvm﹕ VFY: unable to resolve virtual method 13936: Landroid/view/ViewGroup;.onRtlPropertiesChanged (I)V
09-04 13:38:20.327 10194-10194/ D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0007
09-04 13:38:20.327 10194-10194/ I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
09-04 13:38:20.327 10194-10194/ W/dalvikvm﹕ VFY: unable to resolve virtual method 401:
Landroid/content/res/TypedArray;.getChangingConfigurations ()I
09-04 13:38:20.327 10194-10194/ D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
09-04 13:38:20.327 10194-10194/ I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
09-04 13:38:20.327 10194-10194/ W/dalvikvm﹕ VFY: unable to resolve virtual method 423: Landroid/content/res/TypedArray;.getType (I)I
09-04 13:38:20.327 10194-10194/ D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
09-04 13:38:20.379 10194-10199 D/dalvikvm﹕ GC_CONCURRENT freed 182K, 3% free 10944K/11207K, paused 15ms+0ms, total 17ms
09-04 13:38:20.928 10194-10201/ I/jdwp﹕ Ignoring second debugger -- accepting and dropping
09-04 13:38:21.233 10194-10194/ I/Choreographer﹕ Skipped 44 frames! The application may be doing too much work on its main thread.
09-04 13:38:21.233 10194-10194/ D/gralloc_goldfish﹕ Emulator without GPU emulation detected.

What do these Android logcat warnings mean?

It doesn't seem to impact anything in my app... yet. I'm using the Android support libraries for the first time (my projects to date have not used support libraries), but this is a new project without much in the way of customization yet. Activities were generated by Android Studio 0.9.2 and implement Navigation Drawer.
Running this on a Verizon Samsung Galaxy SIII running Android 4.4.2. Project is set to minSDK of 15 and targeted SDK of 21.
11-21 10:31:18.204 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
11-21 10:31:18.204 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 11400: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
11-21 10:31:18.204 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-21 10:31:18.204 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
11-21 10:31:18.204 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 11406: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
11-21 10:31:18.204 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-21 10:31:18.204 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
11-21 10:31:18.204 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 8977: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
11-21 10:31:18.204 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
11-21 10:31:18.234 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
11-21 10:31:18.234 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 368: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
11-21 10:31:18.234 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-21 10:31:18.234 7095-7095/com.myapp.debug I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
11-21 10:31:18.234 7095-7095/com.myapp.debug W/dalvikvm﹕ VFY: unable to resolve virtual method 390: Landroid/content/res/TypedArray;.getType (I)I
11-21 10:31:18.234 7095-7095/com.myapp.debug D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
If I'm guessing (and I am), I'm missing a library that android.support.v7 requires. But I have no idea what or where to find it.
I would like to add on top of what #Monte Creasor explained.
I have had the same issue and consulted this bug report which basically says that the problem might be caused by com.android.support:appcompat-v7:21.0.3, on of the main dependencies required to use Android's new Layout capabilities.
Try going back to the v7:20.0.0, this should solve the issue as it did for me and this bug report writer.
Actually all you have to change is in the app build.gradle the line:
compile 'com.android.support:appcompat-v7:21.0.3' or whatever later version you have
to
compile 'com.android.support:appcompat-v7:20.0.0'
These errors occur when you run android studio 1.0 using the sliding drawer sample WITHOUT adding any additional code and using all the defaults the project creation wizard offers. So it would seem to be an Android Studio problem and not a developer coding error.
I had the same issue, also I wasn't able to get my ListFragment scrollable. Used v4 support library 21.0.3 before and upgraded to 22.0.0.
This fixed my problems!
I'm currently going through my logs generated from using Sony's remote device lab, the same warning appears so it's not a Android Studio problem. I suspect its a problem with the ActionBar theme used during the development of the application.

Display Map on Android

Possible many duplicates.
Here is the Logcat dump :
09-12 14:21:34.654: I/u(5812): Making Creator dynamically
09-12 14:21:34.694: I/Google Maps Android API(5812): Google Play services client version: 5077000
09-12 14:21:34.704: I/dalvikvm(5812): Could not find method gui.a, referenced from method gqh.a
09-12 14:21:34.704: W/dalvikvm(5812): VFY: unable to resolve static method 24934: Lgui;.a (Landroid/content/Context;)Lgrh;
09-12 14:21:34.704: D/dalvikvm(5812): VFY: replacing opcode 0x71 at 0x0003
09-12 14:21:34.704: E/dalvikvm(5812): Could not find class 'gpq', referenced from method gpr.a
09-12 14:21:34.704: W/dalvikvm(5812): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
09-12 14:21:34.704: D/dalvikvm(5812): VFY: replacing opcode 0x22 at 0x0000
09-12 14:21:34.714: E/dalvikvm(5812): Could not find class 'gpq', referenced from method gpr.a
09-12 14:21:34.714: W/dalvikvm(5812): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
09-12 14:21:34.714: D/dalvikvm(5812): VFY: replacing opcode 0x22 at 0x0000
09-12 14:21:34.714: E/dalvikvm(5812): Could not find class 'gpq', referenced from method gpr.a
09-12 14:21:34.714: W/dalvikvm(5812): VFY: unable to resolve new-instance 4090 (Lgpq;) in Lgpr;
09-12 14:21:34.714: D/dalvikvm(5812): VFY: replacing opcode 0x22 at 0x0000
09-12 14:21:34.714: D/dalvikvm(5812): DexOpt: unable to opt direct call 0x5ea1 at 0x0a in Lgpr;.a
09-12 14:21:34.714: D/dalvikvm(5812): DexOpt: unable to opt direct call 0x5ea1 at 0x0c in Lgpr;.a
09-12 14:21:34.714: D/dalvikvm(5812): DexOpt: unable to opt direct call 0x5ea1 at 0x0a in Lgpr;.a
09-12 14:21:34.714: I/Google Maps Android API(5812): Google Play services package version: 5089034
09-12 14:21:34.724: W/dalvikvm(5812): VFY: unable to resolve static field 20875 (t) in Lyo;
09-12 14:21:34.724: D/dalvikvm(5812): VFY: replacing opcode 0x62 at 0x000e
09-12 14:21:34.724: W/dalvikvm(5812): VFY: unable to resolve static field 20875 (t) in Lyo;
09-12 14:21:34.724: D/dalvikvm(5812): VFY: replacing opcode 0x62 at 0x000d
09-12 14:21:34.944: I/LoadedApk(5812): connected(), package name=com.google.android.gms ,class name=com.google.android.gms.maps.auth.ApiTokenService
09-12 14:21:35.024: I/dalvikvm(5812): Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4023 'Lglm;'
09-12 14:21:35.024: W/dalvikvm(5812): Link of class 'Lcom/google/android/gms/location/internal/ParcelableGeofence;' failed
09-12 14:21:35.024: E/dalvikvm(5812): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method gls.a
09-12 14:21:35.024: W/dalvikvm(5812): VFY: unable to resolve check-cast 2086 (Lcom/google/android/gms/location/internal/ParcelableGeofence;) in Lgls;
09-12 14:21:35.024: D/dalvikvm(5812): VFY: replacing opcode 0x1f at 0x0019
09-12 14:21:35.134: D/libEGL(5812): loaded /system/lib/egl/libEGL_adreno200.so
09-12 14:21:35.144: D/libEGL(5812): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
09-12 14:21:35.154: D/libEGL(5812): loaded /system/lib/egl/libGLESv2_adreno200.so
09-12 14:21:35.154: I/Adreno200-EGL(5812): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_JB_2.5.04.02.02.040.400_msm8960_JB_2.5_CL3744273_release_AU (CL3744273)
09-12 14:21:35.154: I/Adreno200-EGL(5812): Build Date: 06/30/13 Sun
09-12 14:21:35.154: I/Adreno200-EGL(5812): Local Branch:
09-12 14:21:35.154: I/Adreno200-EGL(5812): Remote Branch: quic/jb_2.5
09-12 14:21:35.154: I/Adreno200-EGL(5812): Local Patches: NONE
09-12 14:21:35.154: I/Adreno200-EGL(5812): Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.04.02.02.040.400 + NOTHING
09-12 14:21:35.244: D/OpenGLRenderer(5812): Enabling debug mode 0
09-12 14:22:10.242: W/InputEventReceiver(5812): Attempted to finish an input event but the input event receiver has already been disposed.
09-12 14:22:15.788: I/LoadedApk(5812): connected(), package name=com.google.android.gms ,class name=com.google.android.gms.maps.auth.ApiTokenService
09-12 14:23:01.837: I/LoadedApk(5812): connected(), package name=com.google.android.gms ,class name=com.google.android.gms.maps.auth.ApiTokenService
09-12 14:23:59.618: I/LoadedApk(5812): connected(), package name=com.google.android.gms ,class name=com.google.android.gms.maps.auth.ApiTokenService
Code :
Android Manifest File :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission android:name="com.example.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.maps.permission.MAPS_RECEIVE"/>
<!-- Needed -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Not needed -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="*KEY*"/>
<activity
android:name="com.example.maps.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>
</application>
Layout XML :
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
tools:context=".MainActivity"
/>
Main Activity :
package com.example.maps;
import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Question :
1) It just loads the blanks google page. What else I need to mention?
2) Where can I find the way that will work on all version , as I see many addition in manifest file with change in android version.
Sorry for such a big post.
Few Points : after reading many post in StackOverflow,
1) It says to add me
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
lines in Manifest. Earlier it was not required as I run the same app without using this.
2) It says to change
class="com.google.android.gms.maps.Fragment"
to
class="com.google.android.gms.maps.SupportMapFragment"
Otherwise it will crash saying xml inflation issue.
3) There is chance of that the application is signed with different keystore and thus the API key wont work. So I signed the apk with new keystore and used the same sha for generating the API key.

Unable to find classes in Android library file

I have created a very simple Android app just to work with functionality. Within the app I would like to call a web service client to retrieve and display some data. I think I have succesfully imported and referenced the jar file (i.e. library). It appears to be instantiating the class successfully but when that class is referencing another class within the jar/library it throws a class not found error. Any ideas??? Anything else I can provide to help answer???
Here is my code:
package mhcs.android.ehd;
import mhcs.services.client.EHD.EHDClient;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class GetTicketDescription extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
EHDClient client = new EHDClient();
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String title = getString(R.string.title);
setTitle(title); // done so that we can change the default title
//get handles to editText and button widgets
final EditText eText = (EditText) findViewById(R.id.editText1);
final Button button = (Button) findViewById(R.id.button1);
eText.setText(client.getTicketDescription("MMLZ-8LVRMK"));
button.setOnClickListener(new Button.OnClickListener(){
#Override
public void onClick(View v) {
//get the String entered into the editText widget
CharSequence editText = eText.getText();
//display the toast
Toast.makeText(GetTicketDescription.this, editText, Toast.LENGTH_LONG).show();
}
});
}
}
Here is the error:
D/dalvikvm(538): Not late-enabling CheckJNI (already on)
I/dalvikvm(538): threadid=3: reacting to signal 3
I/dalvikvm(538): Wrote stack traces to '/data/anr/traces.txt'
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
E/dalvikvm(538): Could not find class 'org.tempuri.EHDLookupService', referenced from method mhcs.services.client.EHD.EHDClient.<init>
W/dalvikvm(538): VFY: unable to resolve new-instance 93 (Lorg/tempuri/EHDLookupService;) in Lmhcs/services/client/EHD/EHDClient;
D/dalvikvm(538): VFY: replacing opcode 0x22 at 0x0003
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
I/dalvikvm(538): Could not find method org.tempuri.EHDLookupService.getBasicHttpBindingIEHDLookupService, referenced from method mhcs.services.client.EHD.EHDClient.<init>
W/dalvikvm(538): VFY: unable to resolve virtual method 112: Lorg/tempuri/EHDLookupService;.getBasicHttpBindingIEHDLookupService ()Lorg/tempuri/IEHDLookupService;
D/dalvikvm(538): VFY: replacing opcode 0x6e at 0x001c
W/dalvikvm(538): VFY: unable to find class referenced in signature (Ljavax/xml/bind/JAXBElement;)
I/dalvikvm(538): Could not find method javax.xml.bind.JAXBElement.getValue, referenced from method mhcs.services.client.EHD.EHDClient.getAssigneeTickets
W/dalvikvm(538): VFY: unable to resolve virtual method 42: Ljavax/xml/bind/JAXBElement;.getValue ()Ljava/lang/Object;
D/dalvikvm(538): VFY: replacing opcode 0x6e at 0x0026
W/dalvikvm(538): VFY: unable to find class referenced in signature (Ljavax/xml/bind/JAXBElement;)
I/dalvikvm(538): Could not find method javax.xml.bind.JAXBElement.getValue, referenced from method mhcs.services.client.EHD.EHDClient.getTicketDescription
W/dalvikvm(538): VFY: unable to resolve virtual method 42: Ljavax/xml/bind/JAXBElement;.getValue ()Ljava/lang/Object;
D/dalvikvm(538): VFY: replacing opcode 0x6e at 0x000b
W/dalvikvm(538): Unable to resolve superclass of Lorg/tempuri/EHDLookupService; (73)
W/dalvikvm(538): Link of class 'Lorg/tempuri/EHDLookupService;' failed
D/dalvikvm(538): DexOpt: unable to opt direct call 0x006b at 0x15 in Lmhcs/services/client/EHD/EHDClient;.<init>
D/AndroidRuntime(538): Shutting down VM
W/dalvikvm(538): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
E/AndroidRuntime(538): FATAL EXCEPTION: main
E/AndroidRuntime(538): java.lang.NoClassDefFoundError: org.tempuri.EHDLookupService
E/AndroidRuntime(538): at mhcs.services.client.EHD.EHDClient.<init>(EHDClient.java:25)
E/AndroidRuntime(538): at mhcs.android.ehd.GetTicketDescription.onCreate(GetTicketDescription.java:15)
E/AndroidRuntime(538): at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime(538): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime(538): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime(538): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime(538): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime(538): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime(538): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(538): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(538): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(538): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(538): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(538): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(538): at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(538): threadid=3: reacting to signal 3
I/dalvikvm(538): Wrote stack traces to '/data/anr/traces.txt'
Note: I understand the issue with org/tempuri and will correct.
(Can't post image of my workspace as I am a new user)
Find Properties -> Java Build Path -> Order and Export
Change Android Dependencies order
Try to create a new folder called libs under your project and put the .jar file there...
I had the same problem, I tried to mark the Android Private Libraries under Order and Export and it didn't work for me. Then I noticed that my libs folder wasn't referenced under the Java Build Path. So I just added it to Libraries and it worked.
Go to
Project> Build Path >Configure Build Path
Check the Libraries you wanted and hit ok

Categories

Resources