I am using Google play services for activity recognition to detect various activities like: Still, On Foot etc. But the code works fine on Moto g devices and fails on HTC one. Can you please verify if my approach is correct? Here are the codes:
My Activity:
public class MyActivity extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private PendingIntent pIntent;
GoogleApiClient mGoogleApiClient;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(ActivityRecognition.API).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
mGoogleApiClient.connect();
IntentFilter filter = new IntentFilter();
filter.addAction("ACTIVITY_RECOGNITION");//For filtering
}
#Override
public void onConnected(Bundle arg0) {
Intent intent = new Intent(this, ActivityRecognitionService.class);
pIntent = PendingIntent.getService(this, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT);
ActivityRecognition.ActivityRecognitionApi.requestActivityUpdates(mGoogleApiClient, 0, pIntent);//0
}
/*#Override
public void onDisconnected() {
}*/
//#Override
public void onConnectionSuspended(int arg0) {
// TODO Auto-generated method stub
}
#Override
public void onConnectionFailed(ConnectionResult result) {
// TODO Auto-generated method stub
}
where as ActivityRecognitionService looks like:
public class ActivityRecognitionService extends IntentService {
public ActivityRecognitionService() {
super("My Activity Recognition Service");
}
#Override
protected void onHandleIntent(Intent intent) {
if(ActivityRecognitionResult.hasResult(intent)){
ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
Log.i(TAG, getType(result.getMostProbableActivity().getType()) + "t" + result.getMostProbableActivity().getConfidence());
/*Intent i = new Intent("ACTIVITY_RECOGNITION");
i.putExtra("Activity", getType(result.getMostProbableActivity().getType()) );
i.putExtra("Confidence", result.getMostProbableActivity().getConfidence());
sendBroadcast(i);*/
String aType = getType(result.getMostProbableActivity().getType());
int aConf = result.getMostProbableActivity().getConfidence();
fileWrite(aType, aConf);
}
}
private String getType(int type){
if(type == DetectedActivity.UNKNOWN)
return "Unknown";
else if(type == DetectedActivity.IN_VEHICLE)
return "In Vehicle";
}
On HTC i am getting following message in logcat: (Although i got similar messages on moto g, but it still detects the activity)
09-28 19:09:11.143: W/asset(7697): Copying FileAsset 0x727dbe28 (zip:/data/app/com.example.activityRec-2.apk:/resources.arsc) to buffer size 254736 to make it aligned.
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;)
09-28 19:09:11.173: W/dalvikvm(7697): Unable to resolve superclass of Lcom/google/android/gms/internal/zzlp; (184)
09-28 19:09:11.173: W/dalvikvm(7697): Link of class 'Lcom/google/android/gms/internal/zzlp;' failed
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Lcom/google/android/gms/internal/zzlp;)
09-28 19:09:11.173: W/dalvikvm(7697): Unable to resolve superclass of Lcom/google/android/gms/internal/zzlp; (184)
09-28 19:09:11.173: W/dalvikvm(7697): Link of class 'Lcom/google/android/gms/internal/zzlp;' failed
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Lcom/google/android/gms/internal/zzlp;)
09-28 19:09:11.173: W/dalvikvm(7697): Unable to resolve superclass of Lcom/google/android/gms/internal/zzlp; (184)
09-28 19:09:11.173: W/dalvikvm(7697): Link of class 'Lcom/google/android/gms/internal/zzlp;' failed
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Lcom/google/android/gms/internal/zzlp;)
09-28 19:09:11.173: W/dalvikvm(7697): Unable to resolve superclass of Lcom/google/android/gms/internal/zzlp; (184)
09-28 19:09:11.173: W/dalvikvm(7697): Link of class 'Lcom/google/android/gms/internal/zzlp;' failed
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to resolve virtual method 21831: Lcom/google/android/gms/internal/zzlp;.zza (ILcom/google/android/gms/common/api/GoogleApiClient;Lcom/google/android/gms/common/api/GoogleApiClient$OnConnectionFailedListener;)V
09-28 19:09:11.173: W/dalvikvm(7697): Unable to resolve superclass of Lcom/google/android/gms/internal/zzlp; (184)
09-28 19:09:11.173: W/dalvikvm(7697): Link of class 'Lcom/google/android/gms/internal/zzlp;' failed
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to resolve static method 21829: Lcom/google/android/gms/internal/zzlp;.zza (Landroid/support/v4/app/FragmentActivity;)Lcom/google/android/gms/internal/zzlp;
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;)
09-28 19:09:11.173: E/dalvikvm(7697): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.enableAutoManage
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to resolve check-cast 185 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/api/GoogleApiClient$Builder;
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;)
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;)
09-28 19:09:11.173: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to resolve virtual method 134: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
09-28 19:09:11.183: E/dalvikvm(7697): Could not find class 'android.support.v4.app.NotificationCompat$Builder', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to resolve new-instance 188 (Landroid/support/v4/app/NotificationCompat$Builder;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
09-28 19:09:11.183: E/dalvikvm(7697): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to resolve instanceof 185 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
09-28 19:09:11.183: E/dalvikvm(7697): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to resolve check-cast 185 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
09-28 19:09:11.183: W/dalvikvm(7697): VFY: unable to resolve virtual method 293: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
09-28 19:09:11.193: W/dalvikvm(7697): VFY: unable to find class referenced in signature (Landroid/support/v4/app/FragmentActivity;)
09-28 19:09:11.193: W/dalvikvm(7697): Unable to resolve superclass of Lcom/google/android/gms/internal/zzlp; (184)
09-28 19:09:11.193: W/dalvikvm(7697): Link of class 'Lcom/google/android/gms/internal/zzlp;' failed
09-28 19:09:11.193: W/dalvikvm(7697): VFY: unable to resolve static method 21829: Lcom/google/android/gms/internal/zzlp;.zza (Landroid/support/v4/app/FragmentActivity;)Lcom/google/android/gms/internal/zzlp;
09-28 19:09:11.193: W/GooglePlayServicesUtil(7697): Google Play services out of date. Requires 8115000 but found 4324038
09-28 19:09:11.233: I/Adreno-EGL(7697): <qeglDrvAPI_eglInitialize:385>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_KK_3.5_RB1.04.04.02.006.066_msm8974_refs/tags/AU_LINUX_ANDROID_KK_3.5_RB1.04.04.02.006.066__release_AU ()
09-28 19:09:11.233: I/Adreno-EGL(7697): OpenGL ES Shader Compiler Version: E031.24.00.06
09-28 19:09:11.233: I/Adreno-EGL(7697): Build Date: 02/06/14 Thu
09-28 19:09:11.233: I/Adreno-EGL(7697): Local Branch:
09-28 19:09:11.233: I/Adreno-EGL(7697): Remote Branch: refs/tags/AU_LINUX_ANDROID_KK_3.5_RB1.04.04.02.006.066
09-28 19:09:11.233: I/Adreno-EGL(7697): Local Patches: NONE
09-28 19:09:11.233: I/Adreno-EGL(7697): Reconstruct Branch: NOTHING
09-28 19:09:49.563: W/GooglePlayServicesUtil(7697): Google Play services out of date. Requires 8115000 but found 4324038
09-28 19:11:22.253: W/GooglePlayServicesUtil(7697): Google Play services out of date. Requires 8115000 but found 4324038
09-28 19:11:23.373: W/GooglePlayServicesUtil(7697): Google Play services out of date. Requires 8115000 but found 4324038
Update
update2
error log
09-29 11:52:13.790: W/asset(10716): Copying FileAsset 0x77fe6e98 (zip:/data/app/com.example.activityRec-1.apk:/resources.arsc) to buffer size 254736 to make it aligned.
09-29 11:52:13.820: W/dalvikvm(10716): VFY: unable to resolve virtual method 236: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
09-29 11:52:13.830: W/dalvikvm(10716): VFY: unable to resolve virtual method 527: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
09-29 11:52:13.830: D/At least(10716): it creats
09-29 11:52:13.840: W/GooglePlayServicesUtil(10716): Google Play services out of date. Requires 8115000 but found 4324038
09-29 11:52:13.880: I/Adreno-EGL(10716): <qeglDrvAPI_eglInitialize:385>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_KK_3.5_RB1.04.04.02.006.066_msm8974_refs/tags/AU_LINUX_ANDROID_KK_3.5_RB1.04.04.02.006.066__release_AU ()
09-29 11:52:13.880: I/Adreno-EGL(10716): OpenGL ES Shader Compiler Version: E031.24.00.06
09-29 11:52:13.880: I/Adreno-EGL(10716): Build Date: 02/06/14 Thu
09-29 11:52:13.880: I/Adreno-EGL(10716): Local Branch:
09-29 11:52:13.880: I/Adreno-EGL(10716): Remote Branch: refs/tags/AU_LINUX_ANDROID_KK_3.5_RB1.04.04.02.006.066
09-29 11:52:13.880: I/Adreno-EGL(10716): Local Patches: NONE
09-29 11:52:13.880: I/Adreno-EGL(10716): Reconstruct Branch: NOTHING
SDK image
The error is because you have missed this part of the support library setup guide
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
The app runs fine on lollipop because it has the classes needed for card views but the older devices don't hence the need for the support lib.
Related
I have a problem with my test Google Map application.
It perfectly run only on one phone Xiaomi Redme 3 (5.1.1).
But when I run it in debug mode on another phone Samsung S3 mini (4.1.2) from the same computer, it not works, only blank windows with an inscription Google.
Also it not works on Asus Zenphone 5 (4.2.2).
Below my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="elcom.maps">
<!--
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.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<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.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIza..1DM"/>
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Also below android monitor log:
08-30 17:29:50.608 27197-27197/elcom.maps E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.google.android.gms.common.zze.zzas
08-30 17:29:50.608 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve check-cast 246 (Landroid/os/UserManager;) in Lcom/google/android/gms/common/zze;
08-30 17:29:50.618 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zze.zzs
08-30 17:29:50.618 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 482: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
08-30 17:29:50.638 27197-27197/elcom.maps E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.internal.zzacw.zzg
08-30 17:29:50.638 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve check-cast 27 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/internal/zzacw;
08-30 17:29:50.698 27197-27197/elcom.maps I/zzai: Making Creator dynamically
08-30 17:29:52.140 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.ContextWrapper.createCredentialProtectedStorageContext, referenced from method hfi.createCredentialProtectedStorageContext
08-30 17:29:52.140 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 935: Landroid/content/ContextWrapper;.createCredentialProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:52.140 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.ContextWrapper.createDeviceProtectedStorageContext, referenced from method hfi.createDeviceProtectedStorageContext
08-30 17:29:52.140 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 936: Landroid/content/ContextWrapper;.createDeviceProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:52.140 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.ContextWrapper.createCredentialProtectedStorageContext, referenced from method com.google.android.chimera.ModuleContext.createCredentialProtectedStorageContext
08-30 17:29:52.150 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 935: Landroid/content/ContextWrapper;.createCredentialProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:52.150 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.ContextWrapper.createDeviceProtectedStorageContext, referenced from method com.google.android.chimera.ModuleContext.createDeviceProtectedStorageContext
08-30 17:29:52.150 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 936: Landroid/content/ContextWrapper;.createDeviceProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:52.150 27197-27197/elcom.maps I/dalvikvm: Could not find method com.google.android.chimera.ContextThemeWrapper.createDisplayContext, referenced from method com.google.android.chimera.ModuleContext.createDisplayContext
08-30 17:29:52.150 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 6176: Lcom/google/android/chimera/ContextThemeWrapper;.createDisplayContext (Landroid/view/Display;)Landroid/content/Context;
08-30 17:29:52.160 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.Context.isCredentialProtectedStorage, referenced from method buc.a
08-30 17:29:52.160 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 916: Landroid/content/Context;.isCredentialProtectedStorage ()Z
08-30 17:29:52.160 27197-27197/elcom.maps E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method buc.a
08-30 17:29:52.160 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve check-cast 355 (Landroid/os/UserManager;) in Lbuc;
08-30 17:29:52.160 27197-27197/elcom.maps I/dalvikvm: Could not find method android.os.UserManager.isUserUnlocked, referenced from method buc.a
08-30 17:29:52.160 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 1507: Landroid/os/UserManager;.isUserUnlocked ()Z
08-30 17:29:52.160 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method buc.b
08-30 17:29:52.160 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 917: Landroid/content/Context;.isDeviceProtectedStorage ()Z
08-30 17:29:52.170 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method buc.c
08-30 17:29:52.170 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 917: Landroid/content/Context;.isDeviceProtectedStorage ()Z
08-30 17:29:52.780 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve static field 350 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
08-30 17:29:52.780 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve static field 349 (SUPPORTED_32_BIT_ABIS) in Landroid/os/Build;
08-30 17:29:52.780 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve static field 351 (SUPPORTED_ABIS) in Landroid/os/Build;
08-30 17:29:52.780 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve static field 350 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
08-30 17:29:52.780 27197-27197/elcom.maps I/dalvikvm: DexOpt: unable to optimize static field ref 0x015e at 0x17 in Lbwc;.a
08-30 17:29:52.780 27197-27197/elcom.maps I/dalvikvm: DexOpt: unable to optimize static field ref 0x015d at 0x26 in Lbwc;.a
08-30 17:29:52.780 27197-27197/elcom.maps I/dalvikvm: DexOpt: unable to optimize static field ref 0x015e at 0x0d in Lbwc;.b
08-30 17:29:53.721 27197-27197/elcom.maps I/Google Maps Android API: Google Play services client version: 10084000
08-30 17:29:53.741 27197-27197/elcom.maps I/Google Maps Android API: Google Play services package version: 11302034
08-30 17:29:53.871 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method ji.a
08-30 17:29:53.871 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 2148: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
08-30 17:29:53.871 27197-27197/elcom.maps E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method ji.a
08-30 17:29:53.871 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve check-cast 452 (Landroid/os/UserManager;) in Lji;
08-30 17:29:53.881 27197-27197/elcom.maps I/dalvikvm: Could not find method android.content.pm.PackageManager.isInstantApp, referenced from method com.google.maps.api.android.lib6.drd.av.a
08-30 17:29:53.881 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 2153: Landroid/content/pm/PackageManager;.isInstantApp (Ljava/lang/String;)Z
08-30 17:29:54.592 27197-27197/elcom.maps I/dalvikvm: Could not find method android.widget.RelativeLayout$LayoutParams.setMarginStart, referenced from method com.google.maps.api.android.lib6.impl.o.a
08-30 17:29:54.592 27197-27197/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 2878: Landroid/widget/RelativeLayout$LayoutParams;.setMarginStart (I)V
08-30 17:29:55.353 27197-27197/elcom.maps W/age: copyMemory is missing from platform - proto runtime falling back to safer methods.
08-30 17:29:56.434 27197-27197/elcom.maps I/libblt_hw: Library opened (handle = 0, fd = 88)
08-30 17:29:57.355 27197-27543/elcom.maps W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
08-30 17:29:58.286 27197-27543/elcom.maps I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:4
08-30 17:29:58.286 27197-27543/elcom.maps I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 4
08-30 17:29:58.306 27197-27543/elcom.maps I/dalvikvm: Could not find method android.content.ContextWrapper.createCredentialProtectedStorageContext, referenced from method ax.createCredentialProtectedStorageContext
08-30 17:29:58.326 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 63: Landroid/content/ContextWrapper;.createCredentialProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:58.326 27197-27543/elcom.maps I/dalvikvm: Could not find method android.content.ContextWrapper.createDeviceProtectedStorageContext, referenced from method ax.createDeviceProtectedStorageContext
08-30 17:29:58.336 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 64: Landroid/content/ContextWrapper;.createDeviceProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:58.336 27197-27543/elcom.maps I/dalvikvm: Could not find method e.createCredentialProtectedStorageContext, referenced from method f.createCredentialProtectedStorageContext
08-30 17:29:58.336 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 365: Le;.createCredentialProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:58.336 27197-27543/elcom.maps I/dalvikvm: Could not find method e.createDeviceProtectedStorageContext, referenced from method f.createDeviceProtectedStorageContext
08-30 17:29:58.336 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 366: Le;.createDeviceProtectedStorageContext ()Landroid/content/Context;
08-30 17:29:58.336 27197-27543/elcom.maps I/dalvikvm: Could not find method e.createDisplayContext, referenced from method f.createDisplayContext
08-30 17:29:58.336 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve virtual method 367: Le;.createDisplayContext (Landroid/view/Display;)Landroid/content/Context;
08-30 17:29:58.376 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve static field 76 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
08-30 17:29:58.376 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve static field 75 (SUPPORTED_32_BIT_ABIS) in Landroid/os/Build;
08-30 17:29:58.376 27197-27543/elcom.maps W/dalvikvm: VFY: unable to resolve static field 76 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
08-30 17:29:58.376 27197-27543/elcom.maps I/dalvikvm: DexOpt: unable to optimize static field ref 0x004c at 0x17 in Laa;.a
08-30 17:29:58.376 27197-27543/elcom.maps I/dalvikvm: DexOpt: unable to optimize static field ref 0x004b at 0x26 in Laa;.a
08-30 17:29:58.396 27197-27543/elcom.maps I/dalvikvm: DexOpt: unable to optimize static field ref 0x004c at 0x0d in Laa;.b
08-30 17:34:06.705 27197-27197/elcom.maps W/InputMethodManager: Ignoring onBind: cur seq=-1, given seq=128
How to solve this problem?
I read many similar topics but no results.
Standard Google Map application works fine on problem device.
I tried to reinstall application, clear cache, but result the same.
Update:
When I change SHA1 for debug key to wrong value in APIS console, on Xiaomi marker appears on grey blank screen, but on Samsung only grey screen without marker.
if it's release version , be sure to add the key here too :
It is a very strange situation, after the weekend it all worked on all devices without changing the code! Maybe there is a delay in days to enable maps on second and other devices?
I'm trying to add ads to a simple app, but when the app is running, the screen of the phone is black. I've tried almost all the solutions I've done in Google, but it did not. Is there anyone that can help me. Thanks
Codes
import android.widget.LinearLayout;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
public class comSpriteOlusturmaActivity extends BaseGameActivity {
private static final int CAMERA_WIDTH = 800;
private static final int CAMERA_HEIGHT = 480;
private Camera camera;
Texture textureResim1, textureResim2;
TextureRegion textRegResim1, textRegResim2`enter code here`;
Sprite spriteResim1, spriteResim2;
public Engine onLoadEngine()
{
camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
engineOptions.getTouchOptions().setRunOnUpdateThread(true);
Engine engine = new Engine(engineOptions);
return engine;
}
public void onLoadResources()
{
textureResim1=new Texture(128,128,TextureOptions.BILINEAR_PREMULTIPLYALPHA);
textureResim2=new Texture(128,128,TextureOptions.BILINEAR_PREMULTIPLYALPHA);
textRegResim1 = TextureRegionFactory.createFromAsset(textureResim1, this, "gfx/blueSmileIcon.png", 0, 0);
textRegResim2 = TextureRegionFactory.createFromAsset(textureResim2, this, "gfx/yellowSmileIcon.png", 0, 0);
mEngine.getTextureManager().loadTextures(textureResim1, textureResim2);
}
Scene scene;
public Scene onLoadScene()
{
this.mEngine.registerUpdateHandler(new FPSLogger());
this.scene = new Scene();
spriteResim1 = new Sprite(100, 100, textRegResim1);
spriteResim2 = new Sprite(400, 100, textRegResim2);
this.scene.attachChild(spriteResim1);
this.scene.attachChild(spriteResim2);
return this.scene;
}
public void onLoadComplete() {
}
#Override
protected void onSetContentView() {
// TODO Auto-generated method stub
super.onSetContentView();
setContentView(R.layout.main);
LinearLayout layout=(LinearLayout)findViewById(R.id.adView);
AdView adView = new AdView(this);
adView.setAdUnitId("ca-app-pub-8564721389464451/xxxxxxxx");
adView.setAdSize(AdSize.SMART_BANNER);
adView.refreshDrawableState();
adView.setBackgroundColor(android.graphics.Color.TRANSPARENT);
adView.setVisibility(AdView.VISIBLE);
AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("6C9CA739379F3C6E44B497FAF0876D4D")
.build();
adView.loadAd(adRequest);
}
}
layout: main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical" >
</LinearLayout>
Manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="serefakuz.com"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
. <application
android:allowBackup="true"
android:label="#string/app_name"
>
<activity android:name="www.serefakyuz.com.comSpriteOlusturmaActivity"
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="#integer/google_play_services_version" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
</manifest>
Android version 4.2.2 and java version 1.7 in logcat info:
01-06 23:01:37.005: I/PersonaManager(22804): getPersonaService() name persona_policy
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to find class referenced in signature (Landroid/support/v4/app/Fragment;)
01-06 23:01:37.276: E/dalvikvm(22804): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
01-06 23:01:37.276: W/dalvikvm(22804): VFY: unable to resolve instanceof 174 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
01-06 23:01:37.276: D/dalvikvm(22804): VFY: replacing opcode 0x20 at 0x0008
01-06 23:01:37.276: E/dalvikvm(22804): Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
01-06 23:01:37.286: W/dalvikvm(22804): VFY: unable to resolve check-cast 174 (Landroid/support/v4/app/FragmentActivity;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
01-06 23:01:37.286: D/dalvikvm(22804): VFY: replacing opcode 0x1f at 0x000c
01-06 23:01:37.316: I/dalvikvm(22804): Could not find method android.security.NetworkSecurityPolicy.getInstance, referenced from method com.google.android.gms.ads.internal.state.h.a
01-06 23:01:37.316: W/dalvikvm(22804): VFY: unable to resolve static method 2946: Landroid/security/NetworkSecurityPolicy;.getInstance ()Landroid/security/NetworkSecurityPolicy;
01-06 23:01:37.316: D/dalvikvm(22804): VFY: replacing opcode 0x71 at 0x0080
01-06 23:01:37.336: I/dalvikvm(22804): Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method hyx.a
01-06 23:01:37.336: W/dalvikvm(22804): VFY: unable to resolve virtual method 2339: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
01-06 23:01:37.336: D/dalvikvm(22804): VFY: replacing opcode 0x6e at 0x001c
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
01-06 23:01:37.426: W/dalvikvm(22804): VFY: unable to resolve static field 784 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
01-06 23:01:37.426: D/dalvikvm(22804): VFY: replacing opcode 0x62 at 0x0008
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_ABIS
01-06 23:01:37.426: W/dalvikvm(22804): VFY: unable to resolve static field 785 (SUPPORTED_ABIS) in Landroid/os/Build;
01-06 23:01:37.426: D/dalvikvm(22804): VFY: replacing opcode 0x62 at 0x0008
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
01-06 23:01:37.426: W/dalvikvm(22804): VFY: unable to resolve static field 784 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
01-06 23:01:37.426: D/dalvikvm(22804): VFY: replacing opcode 0x62 at 0x0012
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_32_BIT_ABIS
01-06 23:01:37.426: W/dalvikvm(22804): VFY: unable to resolve static field 783 (SUPPORTED_32_BIT_ABIS) in Landroid/os/Build;
01-06 23:01:37.426: D/dalvikvm(22804): VFY: replacing opcode 0x62 at 0x0021
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
01-06 23:01:37.426: I/dalvikvm(22804): DexOpt: unable to optimize static field ref 0x0310 at 0x0d in Lcom/google/android/chimera/container/internal/NativeLibUtils;.a
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
01-06 23:01:37.426: I/dalvikvm(22804): DexOpt: unable to optimize static field ref 0x0310 at 0x17 in Lcom/google/android/chimera/container/internal/NativeLibUtils;.getSupportedAbisForCurrentRuntime
01-06 23:01:37.426: D/dalvikvm(22804): DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_32_BIT_ABIS
01-06 23:01:37.426: I/dalvikvm(22804): DexOpt: unable to optimize static field ref 0x030f at 0x26 in Lcom/google/android/chimera/container/internal/NativeLibUtils;.getSupportedAbisForCurrentRuntime
01-06 23:01:37.436: I/PersonaManager(22804): getPersonaService() name persona_policy
01-06 23:01:37.436: I/dalvikvm(22804): Could not find method android.content.ContextWrapper.createCredentialProtectedStorageContext, referenced from method com.google.android.chimera.ModuleContext.createCredentialProtectedStorageContext
01-06 23:01:37.436: W/dalvikvm(22804): VFY: unable to resolve virtual method 2232: Landroid/content/ContextWrapper;.createCredentialProtectedStorageContext ()Landroid/content/Context;
01-06 23:01:37.436: D/dalvikvm(22804): VFY: replacing opcode 0x6f at 0x0002
01-06 23:01:37.436: I/dalvikvm(22804): Could not find method android.content.ContextWrapper.createDeviceProtectedStorageContext, referenced from method com.google.android.chimera.ModuleContext.createDeviceProtectedStorageContext
01-06 23:01:37.436: W/dalvikvm(22804): VFY: unable to resolve virtual method 2233: Landroid/content/ContextWrapper;.createDeviceProtectedStorageContext ()Landroid/content/Context;
01-06 23:01:37.436: D/dalvikvm(22804): VFY: replacing opcode 0x6f at 0x0002
01-06 23:01:37.436: D/DynamitePackage(22804): Instantiated singleton DynamitePackage.
01-06 23:01:37.436: D/DynamitePackage(22804): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
01-06 23:01:37.446: I/dalvikvm(22804): Could not find method android.security.NetworkSecurityPolicy.getInstance, referenced from method com.google.android.gms.ads.internal.state.h.a
01-06 23:01:37.446: W/dalvikvm(22804): VFY: unable to resolve static method 2563: Landroid/security/NetworkSecurityPolicy;.getInstance ()Landroid/security/NetworkSecurityPolicy;
01-06 23:01:37.446: D/dalvikvm(22804): VFY: replacing opcode 0x71 at 0x0080
01-06 23:01:37.456: I/dalvikvm(22804): Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method zz.a
01-06 23:01:37.456: W/dalvikvm(22804): VFY: unable to resolve virtual method 2120: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
01-06 23:01:37.456: D/dalvikvm(22804): VFY: replacing opcode 0x6e at 0x001c
01-06 23:01:37.486: V/WebViewChromium(22804): Binding Chromium to the main looper Looper (main, tid 1) {4201cdd0}
01-06 23:01:37.486: I/chromium(22804): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
01-06 23:01:37.486: I/BrowserProcessMain(22804): Initializing chromium process, renderers=0
01-06 23:01:37.516: W/chromium(22804): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
01-06 23:01:37.516: E/dalvikvm(22804): Could not find class 'com.google.android.chimera.Activity', referenced from method aat.b
01-06 23:01:37.516: W/dalvikvm(22804): VFY: unable to resolve instanceof 777 (Lcom/google/android/chimera/Activity;) in Laat;
01-06 23:01:37.516: D/dalvikvm(22804): VFY: replacing opcode 0x20 at 0x016f
01-06 23:01:37.516: I/Adreno-EGL(22804): <qeglDrvAPI_eglInitialize:381>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8960_KK_2.7_RB1__release_AU ()
01-06 23:01:37.516: I/Adreno-EGL(22804): OpenGL ES Shader Compiler Version: 17.01.12.SPL
01-06 23:01:37.516: I/Adreno-EGL(22804): Build Date: 03/25/14 Tue
01-06 23:01:37.516: I/Adreno-EGL(22804): Local Branch:
01-06 23:01:37.516: I/Adreno-EGL(22804): Remote Branch: quic/kk_2.7_rb1.32
01-06 23:01:37.516: I/Adreno-EGL(22804): Local Patches: NONE
01-06 23:01:37.516: I/Adreno-EGL(22804): Reconstruct Branch: NOTHING
01-06 23:01:37.546: W/dalvikvm(22804): VFY: unable to resolve static field 1333 (common_full_open_on_phone) in Lcom/google/android/gms/R$drawable;
01-06 23:01:37.546: W/DynamiteModule(22804): Local module descriptor class for com.google.android.gms.piccard.dynamite not found.
01-06 23:01:37.546: I/DynamiteModule(22804): Considering local module com.google.android.gms.piccard.dynamite:0 and remote module com.google.android.gms.piccard.dynamite:0
01-06 23:01:37.546: W/DynamiteModule(22804): Failed to load module via fast routeaje: No acceptable module found. Local version is 0 and remote version is 0.
01-06 23:01:37.556: D/dalvikvm(22804): VFY: replacing opcode 0x60 at 0x0060
01-06 23:01:37.556: D/dalvikvm(22804): DexOpt: couldn't find static field Lig;.common_google_play_services_notification_ticker
01-06 23:01:37.556: W/DynamiteLoaderImpl(22804): Failed to load module version: module com.google.android.gms.piccard.dynamite not found
01-06 23:01:37.556: W/dalvikvm(22804): VFY: unable to resolve static field 6317 (common_google_play_services_notification_ticker) in Lig;
01-06 23:01:37.556: D/dalvikvm(22804): VFY: replacing opcode 0x60 at 0x0092
01-06 23:01:37.566: D/dalvikvm(22804): DexOpt: couldn't find static field Lig;.common_open_on_phone
01-06 23:01:37.566: I/dalvikvm(22804): DexOpt: unable to optimize static field ref 0x18b5 at 0x62 in Llf;.a
01-06 23:01:37.646: I/Ads(22804): Starting ad request.
01-06 23:01:37.656: I/Ads(22804): Please set theme of AdActivity to #android:style/Theme.Translucent to enable transparent background interstitial ad.
01-06 23:01:37.686: D/AndEngine(22804): UpdateThread interrupted. Don't worry - this Exception is most likely expected!
01-06 23:01:37.686: D/AndEngine(22804): java.lang.InterruptedException
01-06 23:01:37.686: D/AndEngine(22804): at java.lang.Object.wait(Native Method)
01-06 23:01:37.686: D/AndEngine(22804): at java.lang.Object.wait(Object.java:364)
01-06 23:01:37.686: D/AndEngine(22804): at org.anddev.andengine.engine.Engine$State.waitUntilCanUpdate(Engine.java:712)
01-06 23:01:37.686: D/AndEngine(22804): at org.anddev.andengine.engine.Engine.yieldDraw(Engine.java:462)
01-06 23:01:37.686: D/AndEngine(22804): at org.anddev.andengine.engine.Engine.onTickUpdate(Engine.java:453)
01-06 23:01:37.686: D/AndEngine(22804): at org.anddev.andengine.engine.Engine$UpdateThread.run(Engine.java:675)
01-06 23:01:37.696: I/PersonaManager(22804): getPersonaService() name persona_policy
01-06 23:01:37.716: W/DynamiteLoaderImpl(22804): Failed to load module version after staging: module com.google.android.gms.piccard.dynamite not found
01-06 23:01:37.716: W/DynamiteModule(22804): Local module descriptor class for com.google.android.gms.piccard.dynamite not found.
01-06 23:01:37.716: I/DynamiteModule(22804): Considering local module com.google.android.gms.piccard.dynamite:0 and remote module com.google.android.gms.piccard.dynamite:0
01-06 23:01:37.716: E/AppStreamingFragment(22804): No acceptable module found. Local version is 0 and remote version is 0.
01-06 23:01:37.726: D/DynamitePackage(22804): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
01-06 23:01:37.726: I/Ads(22804): Starting ad request.
01-06 23:01:37.736: I/Ads(22804): Please set theme of AdActivity to #android:style/Theme.Translucent to enable transparent background interstitial ad.
01-06 23:01:37.786: D/OpenGLRenderer(22804): Enabling debug mode 0
01-06 23:01:37.906: I/dalvikvm(22804): Total arena pages for JIT: 11
01-06 23:01:37.906: I/dalvikvm(22804): Total arena pages for JIT: 12
01-06 23:01:37.906: I/dalvikvm(22804): Total arena pages for JIT: 13
01-06 23:01:37.906: I/dalvikvm(22804): Total arena pages for JIT: 14
01-06 23:01:41.981: I/dalvikvm(22804): Could not find method android.webkit.WebSettings.setMixedContentMode, referenced from method com.google.android.gms.ads.internal.webview.m.<init>
01-06 23:01:41.981: W/dalvikvm(22804): VFY: unable to resolve virtual method 2837: Landroid/webkit/WebSettings;.setMixedContentMode (I)V
01-06 23:01:41.981: D/dalvikvm(22804): VFY: replacing opcode 0x6e at 0x0058
01-06 23:01:42.051: I/dalvikvm(22804): Total arena pages for JIT: 15
01-06 23:01:42.872: I/Ads(22804): Scheduling ad refresh 60000 milliseconds from now.
01-06 23:01:42.882: W/ActivityThread(22804): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
01-06 23:01:42.912: I/Ads(22804): Ad finished loading.
01-06 23:01:42.932: I/Ads(22804): Scheduling ad refresh 60000 milliseconds from now.
01-06 23:01:42.932: I/Ads(22804): Ad finished loading.
01-06 23:01:43.052: I/chromium(22804): [INFO:CONSOLE(0)] "Document was loaded from Application Cache with manifest https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.appcache", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
01-06 23:01:43.052: I/chromium(22804): [INFO:CONSOLE(0)] "Application Cache Checking event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
01-06 23:01:43.693: I/chromium(22804): [INFO:CONSOLE(0)] "Application Cache NoUpdate event", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40-loader.html (0)
01-06 23:02:42.876: I/Ads(22804): Ad is not visible. Not refreshing ad.
01-06 23:02:42.876: I/Ads(22804): Scheduling ad refresh 60000 milliseconds from now.
01-06 23:02:42.936: I/Ads(22804): Ad is not visible. Not refreshing ad.
01-06 23:02:42.936: I/Ads(22804): Scheduling ad refresh 60000 milliseconds from now.
You need AdView in your main.xml
like this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
tools:context=".MainActivity">
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="#string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
https://firebase.google.com/docs/admob/android/quick-start
I am getting the below error everytime I am building my APK; Gradle build shows it has been done successfully but while installing the APK at my phone, it crashes everytime
10-04 22:52:53.848 9297-9297/com.usfca.studentrecordsverify E/Trace: error opening trace file: No such file or directory (2)
10-04 22:52:53.908 9297-9297/com.usfca.studentrecordsverify E/dalvikvm: Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.monkeyPatchExistingResources
10-04 22:52:53.908 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve check-cast 1786 (Landroid/util/ArrayMap;) in Lcom/android/tools/fd/runtime/MonkeyPatcher;
10-04 22:52:53.908 9297-9297/com.usfca.studentrecordsverify E/dalvikvm: Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.MonkeyPatcher.pruneResourceCache
10-04 22:52:53.908 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve const-class 1786 (Landroid/util/ArrayMap;) in Lcom/android/tools/fd/runtime/MonkeyPatcher;
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve virtual method 437: Landroid/content/Context;.getSystemService (Ljava/lang/Class;)Ljava/lang/Object;
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve virtual method 231: Landroid/app/Activity;.stopLockTask ()V
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.usfca.studentrecordsverify.MainActivity.access$super
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve check-cast 226 (Landroid/os/PersistableBundle;) in Lcom/usfca/studentrecordsverify/MainActivity;
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve virtual method 419: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve virtual method 154: Landroid/app/Activity;.onVisibleBehindCanceled ()V
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify W/dalvikvm: VFY: unable to resolve virtual method 158: Landroid/app/Activity;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
10-04 22:52:53.928 9297-9297/com.usfca.studentrecordsverify E/dalvikvm: Could not find class 'android.os.PersistableBundle', referenced from method com.usfca.studentrecordsverify.MainActivity.access$super
Here is the build.gradle
android.util.ArrayMap was introduced with API-Level 19 (ArrayMap). If you run the code on a Android 4.2.2 device, it it will not find this class on your device and your app will crash.
You can use a java.util.Map instead. It is not as performant as the ArrayMap, but it is available on every Android platform.
change your minSdkVersion to 19
defaultConfig {
applicationId "com.usfca.studentrecordsverification"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
Because ArrayMap was introduced with API-Level 19!
I have integrated Flurry banner ad on my app. On logcat it says BannerAdObject created, but ad is not displayed. I've attached the code and logcat. I have not found any solution for this issue .
mBanner =(RelativeLayout)view.findViewById(R.id.banner);
mFlurryAdBanner = new FlurryAdBanner(getActivity(), mBanner, mAdSpaceName);
mFlurryAdBanner.setListener(bannerAdListener);
FlurryAdBannerListener bannerAdListener = new FlurryAdBannerListener() {
#Override
public void onFetched(FlurryAdBanner adBanner) {
adBanner.displayAd();
}
//... other Overriden method goes here
};
Logcat
05-02 07:16:47.770 15810-15810/com.test W/FlurryAgent: 'setLogEnabled' method is deprecated.
05-02 07:16:47.770 15810-15810/com.test W/FlurryAgent: 'setLogLevel' method is deprecated.
05-02 07:16:47.810 15810-15810/com.test W/FlurryAgent: 'init' method is deprecated.
05-02 07:16:48.100 15810-15964com.test I/FlurryAgent: New main file also not found. returning..
05-02 07:16:48.105 15810-15964/com.test I/FlurryAgent: New main file also not found. returning..
05-02 07:16:48.115 15810-15964/com.test I/dalvikvm: Could not find method android.os.StatFs.getAvailableBlocksLong, referenced from method com.flurry.sdk.ja.a
05-02 07:16:48.120 15810-15964/com.test I/dalvikvm: Could not find method android.webkit.WebSettings.getDefaultUserAgent, referenced from method com.flurry.sdk.dx$1.a
05-02 07:16:48.125 15810-15964/com.test W/FlurryAgent: Flurry session started for context:com.test.SplashActivity#4273f6d8
05-02 07:16:48.125 15810-15964/com.test W/FlurryAgent: Flurry session resumed for context:com.test.SplashActivity#4273f6d8
05-02 07:16:48.140 15810-15964/com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bt; interface 2723 'Lcom/facebook/ads/AdListener;'
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bt;' failed
05-02 07:16:48.140 15810-15964/com.test E/dalvikvm: Could not find class 'com.flurry.sdk.bt', referenced from method com.flurry.sdk.bu.a
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: VFY: unable to resolve new-instance 3271 (Lcom/flurry/sdk/bt;) in Lcom/flurry/sdk/bu;
05-02 07:16:48.140 15810-15964/com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bv; interface 2728 'Lcom/facebook/ads/InterstitialAdListener;'
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bv;' failed
05-02 07:16:48.140 15810-15964/com.test E/dalvikvm: Could not find class 'com.flurry.sdk.bv', referenced from method com.flurry.sdk.bu.a
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: VFY: unable to resolve new-instance 3273 (Lcom/flurry/sdk/bv;) in Lcom/flurry/sdk/bu;
05-02 07:16:48.140 15810-15964com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bt; interface 2723 'Lcom/facebook/ads/AdListener;'
05-02 07:16:48.140 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bt;' failed
05-02 07:16:48.140 15810-15964/com.test D/dalvikvm: DexOpt: unable to opt direct call 0x6634 at 0x0c in Lcom/flurry/sdk/bu;.a
05-02 07:16:48.145 15810-15964/com.test I/dalvikvm: Failed resolving Lcom/flurry/sdk/bv; interface 2728 'Lcom/facebook/ads/InterstitialAdListener;'
05-02 07:16:48.145 15810-15964/com.test W/dalvikvm: Link of class 'Lcom/flurry/sdk/bv;' failed
05-02 07:16:48.145 15810-15964/com.test D/dalvikvm: DexOpt: unable to opt direct call 0x664a at 0x0a in Lcom/flurry/sdk/bu;.a
05-02 07:16:48.165 15810-15964/com.test W/webview_proxy: java.lang.Throwable: Warning: A WebView method was called on thread 'FlurryAgent'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
at android.webkit.WebView.checkThread(WebView.java:1895)
05-02 07:40:05.855 12475-12626/com.test D/FlurryAgent: Referrer file contents: null
05-02 07:40:09.090 12475-12626/com.test W/FlurryAgent: Flurry session resumed for context:com.test.HomeActivity#426ec9d8
05-02 07:40:09.445 12475-12661/com.test W/FlurryAgent: Analytics report sent.
05-02 07:40:10.840 12475-12626/com.test W/FlurryAgent: Flurry session paused for context:com.test.SplashActivity#4277efe8
05-02 07:40:14.440 12475-12475/com.test D/FlurryAgent: BannerAdObject created: com.flurry.sdk.q#42bed4d8
I have some app that needs to be installed on the system directory. I've seen several ways which use adb commands to do so. I think this must be done using the adb shell on the pc and a usb cable. But is there any way for the app to copy itself from Data to system directory without needing a pc?
As I know we can run commands within android app using Runtime. So, I tried this code within onCreate, but it doesn't copy the .apk file. This is the code:
boolean isSystemApp = (getApplicationInfo().flags
& (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0;
if (!isSystemApp) {
Toast.makeText(getApplicationContext (), "not system app", Toast.LENGTH_LONG).show();
try {
String [] commandsOldVersions = {"adb shell\n", "su\n", "mount -o rw,remount /system\n",
"adb push eyedetection.apk /sdcard/\n", "adb shell\n","su cd /sdcard\n"
, "mv eyedetection.apk /system/app\n","su chmod 644/system/app/eyedetection.apk\n" };
String [] commandsNewVersions = {"adb shell\n", "su\n", "mount -o rw,remount /system\n",
"adb push eyedetection.apk /sdcard/\n", "adb shell\n","su cd /sdcard\n"
, "mv eyedetection.apk /system/priv-app\n", "su chmod 644/system/priv-app/eyedetection.apk\n" };
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
// for 4.3 and higher versions, execute the following line (because they've changed their system files hierarchies):
Process process = Runtime.getRuntime().exec(commandsNewVersions);
BufferedReader br= new BufferedReader(new InputStreamReader(process.getInputStream()));
Log.i("cmd", br.readLine());
}//end if
else {
//for older version, execute this line instead
Process process= Runtime.getRuntime().exec(commandsOldVersions);
BufferedReader br= new BufferedReader(new InputStreamReader(process.getInputStream()));
Log.i("cmd", br.readLine());
}//end else.
Runtime.getRuntime().exec("adb reboot");
}//end try.
catch (IOException e) {
Log.i("eyedetection", "error in executing adb commands");
}//end catch.
}//end if the app is not system app.
else {
Toast.makeText(getApplicationContext (), "It's system app", Toast.LENGTH_LONG).show();
}
The app doesn't crash, but I get these lines in the logcat:
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve virtual method 143: Landroid/app/Notification$Builder;.setPriority (I)Landroid/app/Notification$Builder;
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x6e at 0x0042
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection I/dalvikvm: Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.os.b
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve virtual method 142: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x6e at 0x00ce
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection E/dalvikvm: Could not find class 'android.app.Notification$BigTextStyle', referenced from method com.google.android.gms.common.os.b
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve new-instance 42 (Landroid/app/Notification$BigTextStyle;) in Lcom/google/android/gms/common/os;
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x22 at 0x00d7
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: couldn't find field Landroid/app/Notification;.extras
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve instance field 10
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x54 at 0x00ed
03-24 22:28:37.661 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: unable to opt direct call 0x0084 at 0x4c in Lcom/google/android/gms/common/os;.b
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: unable to opt direct call 0x0084 at 0xd9 in Lcom/google/android/gms/common/os;.b
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.ou.a
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve check-cast 30 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/ou;
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x1f at 0x0010
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.ou.a
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve virtual method 430: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
03-24 22:28:37.669 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x6e at 0x000d
03-24 22:28:37.677 22576-22576/com.project.android.eyedetection E/dalvikvm: Could not find class 'android.os.UserManager', referenced from method com.google.android.gms.common.ou.p
03-24 22:28:37.677 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve check-cast 235 (Landroid/os/UserManager;) in Lcom/google/android/gms/common/ou;
03-24 22:28:37.677 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x1f at 0x000e
03-24 22:28:37.677 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
03-24 22:28:37.677 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve static field 119 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
03-24 22:28:37.677 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x62 at 0x000d
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_ABIS
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve static field 120 (SUPPORTED_ABIS) in Landroid/os/Build;
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x62 at 0x0008
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_32_BIT_ABIS
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve static field 118 (SUPPORTED_32_BIT_ABIS) in Landroid/os/Build;
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection D/dalvikvm: VFY: replacing opcode 0x62 at 0x0008
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_64_BIT_ABIS
03-24 22:28:37.685 22576-22576/com.project.android.eyedetection W/dalvikvm: VFY: unable to resolve static field 119 (SUPPORTED_64_BIT_ABIS) in Landroid/os/Build;
Also these lines:
03-24 22:29:54.388 23305-23305/com.project.android.eyedetection E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
03-24 22:29:54.388 23305-23305/com.project.android.eyedetection E/GMPM: Scheduler not set. Not logging error/warn.
03-24 22:29:54.403 23305-23335/com.project.android.eyedetection E/GMPM: Uploading is not possible. App measurement disabled
I couldn't figure out the problem from the logcat. Why the code doesn't work? Is it possible to let the app copy itself to another folder on a rooted device, or must we use usb cable?
The 'adb xxx' command can only be used in a PC shell, not in Android/Linux shell.
That is, you should use
Runtime.getRuntime().exec("reboot")
instead of
Runtime.getRuntime().exec("adb reboot").