My activity don't show map but a black background - android

I'm trying to write my first android application. I've this problem
When i try to show this activity
setContentView(R.layout.activity_poi_map);
This is the file xml of the activity
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
The application show a black background empty and black and the log file is this:
02-20 21:33:45.113: D/libEGL(19145): loaded /system/lib/egl/libEGL_mali.so
02-20 21:33:45.113: D/libEGL(19145): loaded /system/lib/egl/libGLESv1_CM_mali.so
02-20 21:33:45.123: D/libEGL(19145): loaded /system/lib/egl/libGLESv2_mali.so
02-20 21:33:45.153: D/OpenGLRenderer(19145): Enabling debug mode 0
02-20 21:33:45.223: E/SensorManager(19145): thread start
02-20 21:33:45.233: D/SensorManager(19145): registerListener :: handle = 0 name= MPU- 6050 Accelerometer delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl#419da6c0
02-20 21:33:59.237: W/dalvikvm(19145): VFY: unable to resolve static field 849 (MapAttrs) in Lcom/google/android/gms/R$styleable;
02-20 21:33:59.237: D/dalvikvm(19145): VFY: replacing opcode 0x62 at 0x000e
This activity only have to show the map, why don't works?
Thanks in advance for your answer.

unable to resolve static field
That sort of error probably means that you are trying to run mismatched versions of your code together. Clean your build and rebuild everything, and try again.

Related

DB didn't get created in Cordova

I have problem with my first application in Android Studio-Cordova.
I used for my application html,css, jquery and sql.
The application is correct, because I'm attending an on-line course with related code.
It starts, but the message of creating db isn't appeared.
the log of Android Studio is this:
Client not ready yet..Waiting for process to come online
Connected to process 2679 on device Nexus_5_API_19_armeabi_v7a [emulator-5554]
I/InstantRun: Instant Run Runtime started. Android package is com.videocorsi.test, real application class is null.
W/InstantRun: No instant run dex files added to classpath
I/CordovaLog: Changing log level to DEBUG(3)
I/CordovaActivity: Apache Cordova native platform version 6.0.0 is starting
D/CordovaActivity: CordovaActivity.onCreate()
I/dalvikvm: Could not find method android.app.Activity.checkSelfPermission, referenced from method org.apache.cordova.CordovaInterfaceImpl.hasPermission
W/dalvikvm: VFY: unable to resolve virtual method 2: Landroid/app/Activity;.checkSelfPermission (Ljava/lang/String;)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0023
I/dalvikvm: Could not find method android.app.Activity.requestPermissions, referenced from method org.apache.cordova.CordovaInterfaceImpl.requestPermissions
W/dalvikvm: VFY: unable to resolve virtual method 136: Landroid/app/Activity;.requestPermissions ([Ljava/lang/String;I)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0029
V/WebViewChromium: Binding Chromium to the background looper Looper (main, tid 1) {9dd95220}
I/chromium: [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserProcessMain: Initializing chromium process, renderers=0
W/chromium: [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
D/dalvikvm: GC_FOR_ALLOC freed 142K, 12% free 3463K/3892K, paused 86ms, total 88ms
I/dalvikvm-heap: Grow heap (frag case) to 6.078MB for 2536936-byte allocation
D/dalvikvm: GC_FOR_ALLOC freed 0K, 7% free 5941K/6372K, paused 58ms, total 58ms
I/dalvikvm: Could not find method android.webkit.CookieManager.setAcceptThirdPartyCookies, referenced from method org.apache.cordova.engine.SystemCookieManager.<init>
W/dalvikvm: VFY: unable to resolve virtual method 953: Landroid/webkit/CookieManager;.setAcceptThirdPartyCookies (Landroid/webkit/WebView;Z)V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0046
I/dalvikvm: Could not find method android.webkit.CookieManager.flush, referenced from method org.apache.cordova.engine.SystemCookieManager.flush
W/dalvikvm: VFY: unable to resolve virtual method 947: Landroid/webkit/CookieManager;.flush ()V
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0019
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/webkit/ClientCertRequest;)
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/webkit/ClientCertRequest;)
I/dalvikvm: Could not find method android.webkit.WebViewClient.onReceivedClientCertRequest, referenced from method org.apache.cordova.engine.SystemWebViewClient.onReceivedClientCertRequest
W/dalvikvm: VFY: unable to resolve virtual method 1147: Landroid/webkit/WebViewClient;.onReceivedClientCertRequest (Landroid/webkit/WebView;Landroid/webkit/ClientCertRequest;)V
D/dalvikvm: VFY: replacing opcode 0x6f at 0x0031
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/webkit/PermissionRequest;)
I/dalvikvm: Could not find method android.webkit.PermissionRequest.getResources, referenced from method org.apache.cordova.engine.SystemWebChromeClient.onPermissionRequest
W/dalvikvm: VFY: unable to resolve virtual method 964: Landroid/webkit/PermissionRequest;.getResources ()[Ljava/lang/String;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0023
I/dalvikvm: Could not find method android.webkit.WebChromeClient$FileChooserParams.createIntent, referenced from method org.apache.cordova.engine.SystemWebChromeClient.onShowFileChooser
W/dalvikvm: VFY: unable to resolve virtual method 969: Landroid/webkit/WebChromeClient$FileChooserParams;.createIntent ()Landroid/content/Intent;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0021
D/SystemWebViewEngine: CordovaWebView is running on device made by: unknown
D/PluginManager: init()
D/CordovaWebViewImpl: >>> loadUrl(file:///android_asset/www/index.html)
D/CordovaActivity: Started the activity.
D/CordovaActivity: Resumed the activity.
D/OpenGLRenderer: Enabling debug mode 0
I/Choreographer: Skipped 81 frames! The application may be doing too much work on its main thread.
W/AwContents: nativeOnDraw failed; clearing to background color.
W/AwContents: nativeOnDraw failed; clearing to background color.
W/AwContents: nativeOnDraw failed; clearing to background color.
W/AwContents: nativeOnDraw failed; clearing to background color.
D/CordovaWebViewImpl: onPageDidNavigate(file:///android_asset/www/index.html)
D/JsMessageQueue: Set native->JS mode to EvalBridgeMode
I/chromium: [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/chromium: [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/Choreographer: Skipped 74 frames! The application may be doing too much work on its main thread.
D/SystemWebChromeClient: file:///android_asset/www/cordova_plugins.js: Line 7 : Uncaught SyntaxError: Unexpected string
I/chromium: [INFO:CONSOLE(7)] "Uncaught SyntaxError: Unexpected string", source: file:///android_asset/www/cordova_plugins.js (7)
D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
D/SystemWebChromeClient: file:///android_asset/www/js/index.js: Line 39 : Uncaught ReferenceError: listeningElement is not defined
I/chromium: [INFO:CONSOLE(39)] "Uncaught ReferenceError: listeningElement is not defined", source: file:///android_asset/www/js/index.js (39)
D/SystemWebChromeClient: file:///android_asset/www/index.html: Line 237 : Uncaught TypeError: Cannot call method 'transaction' of undefined
I/chromium: [INFO:CONSOLE(237)] "Uncaught TypeError: Cannot call method 'transaction' of undefined", source: file:///android_asset/www/index.html (237)
What Can I do?
the problem was in this file index.js . I had commented this:
receivedEvent: function(id) { var parentElement =document.getElementById(id);
// var listeningElement = parentElement.querySelector('.listening');
//var receivedElement = parentElement.querySelector('.received');
// listeningElement.setAttribute('style', 'display:none;'); //receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id); }
Then, I had move the tag script with my js/jquery code at the end of the tag

RecyclerView with view pager

I have a working piece of code which works when built on other machines but if i build using my machine, the adapter does not show up. No elements of the adapter are populated.
I have RecyclerView inside a ViewPager.
I have updated SDK and Android Studio as well.
LOGS
05-30 16:13:15.637 17918-17918/ E/ViewRootImpl: sendUserActionEvent() mView == null
05-30 16:13:15.877 17918-17922/ D/dalvikvm: GC_CONCURRENT freed 630K, 17% free 9656K/11592K, paused 12ms+4ms, total 39ms
05-30 16:13:15.887 17918-17918/ I/dalvikvm: Could not find method android.widget.LinearLayout$LayoutParams.<init>, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.<init>
05-30 16:13:15.887 17918-17918/ W/dalvikvm: VFY: unable to resolve direct method 19614: Landroid/widget/LinearLayout$LayoutParams;.<init> (Landroid/widget/LinearLayout$LayoutParams;)V
05-30 16:13:15.887 17918-17918/ D/dalvikvm: VFY: replacing opcode 0x70 at 0x0000
05-30 16:13:15.897 17918-17918/ I/dalvikvm: Could not find method android.widget.LinearLayout$LayoutParams.<init>, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.<init>
05-30 16:13:15.897 17918-17918/ W/dalvikvm: VFY: unable to resolve direct method 19614: Landroid/widget/LinearLayout$LayoutParams;.<init> (Landroid/widget/LinearLayout$LayoutParams;)V
05-30 16:13:15.897 17918-17918/ D/dalvikvm: VFY: replacing opcode 0x70 at 0x0000
Please help
I think your build.gradle is missing design dependency,
try compiling this dependency
com.android.support:design:23.4.0
in your build.gradle

When ran an application in Genymotion i get: "Unfortunately, app has stopped."

I'm looking for a good option to automate my tests in a mobile application. Genymotion looks the best option.
So i installed genymotion, added the arm translation and gapps in the vm, but when i try to open my application i get: "Unfortunately, [app name] has stopped."
Applications such clash of clans and facebook does works, and applications such Uber and Netflix doesnt either. This issue happens in an kit kat emulator. Jelly Bean and ICS looks fine.
Here's what logcat says:
01-07 16:31:04.204 2979-2979/com.psafe.powerpro I/MultiDex﹕ VM with version 1.6.0 does not have multidex support
01-07 16:31:04.204 2979-2979/com.psafe.powerpro I/MultiDex﹕ install
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ MultiDexExtractor.load(/data/app/com.psafe.powerpro-1.apk, false)
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ loading existing secondary dex files
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ load found 0 secondary dex files
01-07 16:31:04.212 2979-2979/com.psafe.powerpro I/MultiDex﹕ install done
01-07 16:31:04.232 2979-2979/com.psafe.powerpro I/dalvikvm﹕ Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method gQ.a
01-07 16:31:04.232 2979-2979/com.psafe.powerpro W/dalvikvm﹕ VFY: unable to resolve virtual method 6352: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
01-07 16:31:04.232 2979-2979/com.psafe.powerpro D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
01-07 16:31:04.256 2979-2995/com.psafe.powerpro I/GMPM﹕ App measurement is starting up
01-07 16:31:04.264 2979-2979/com.psafe.powerpro D/dalvikvm﹕ GC_FOR_ALLOC freed 354K, 14% free 3003K/3464K, paused 4ms, total 5ms
01-07 16:31:04.264 2979-2995/com.psafe.powerpro E/GMPM﹕ getGoogleAppId failed with status: 10
01-07 16:31:04.268 2979-2995/com.psafe.powerpro E/GMPM﹕ Uploading is not possible. App measurement disabled
01-07 16:31:04.280 2979-2979/com.psafe.powerpro D/dalvikvm﹕ Trying to load lib /data/data/com.psafe.powerpro/files/libmobilesafe360-jni-2.7.so 0xa50565b0
01-07 16:31:04.308 2979-2979/com.psafe.powerpro A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x000000b4 (code=1), thread 2979 (.psafe.powerpro)
Any toughts about it?

Admob testing issue

I have a problem with my admob implementation and is hoping you guys might be able to help me out.
I can't seem to be able to locate the problem in the log and I am pretty lost. My question is - what have I done wrong since the ad won't load. The app is loading fine but the ad doesn't show - why?. Here is my logcat:
10-31 22:05:31.191: D/AbsListView(11349): Get MotionRecognitionManager
10-31 22:05:31.382: D/dalvikvm(11349): DexOpt: --- BEGIN 'ads-16831983.jar' (bootstrap=0) ---
10-31 22:05:31.432: I/Ads(11349): Starting ad request.
10-31 22:05:31.552: D/libEGL(11349): loaded /system/lib/egl/libEGL_adreno200.so
10-31 22:05:31.552: D/libEGL(11349): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
10-31 22:05:31.562: D/libEGL(11349): loaded /system/lib/egl/libGLESv2_adreno200.so
10-31 22:05:31.562: I/Adreno200-EGL(11349): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: AYELDER_AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.023+PATCH[ES]_msm8960_JB_2.5.5_CL3556704_release_ENGG (CL3556704)
10-31 22:05:31.562: I/Adreno200-EGL(11349): Build Date: 05/17/13 Fri
10-31 22:05:31.562: I/Adreno200-EGL(11349): Local Branch:
10-31 22:05:31.562: I/Adreno200-EGL(11349): Remote Branch: quic/jb_2.5.5
10-31 22:05:31.562: I/Adreno200-EGL(11349): Local Patches: 34c9e193f12610d3e68dabd6198d2c4bfbc66974 RB: Update the master timestamp of the hw_image in rb_texture_update_aliased
10-31 22:05:31.562: I/Adreno200-EGL(11349): Reconstruct Branch: AU_LINUX_ANDROID_JB_2.5.5.04.02.02.092.023 + 01d3c78 + e6f0547 + LOCAL_PATCH[ES]
10-31 22:05:31.602: D/OpenGLRenderer(11349): Enabling debug mode 0
10-31 22:05:31.742: D/dalvikvm(11349): DexOpt: --- END 'ads-16831983.jar' (success) ---
10-31 22:05:31.742: D/dalvikvm(11349): DEX prep '/data/data/com.example.going_android/cache/ads-16831983.jar': unzip in 0ms, rewrite 362ms
10-31 22:05:32.313: W/Ads(11349): There was a problem getting an ad response. ErrorCode: 1
10-31 22:05:32.323: I/dalvikvm(11349): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.o.a.evaluateJavascript
10-31 22:05:32.323: W/dalvikvm(11349): VFY: unable to resolve virtual method 3227: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
10-31 22:05:32.323: D/dalvikvm(11349): VFY: replacing opcode 0x6f at 0x0016
10-31 22:05:32.363: I/webclipboard(11349): clipservice: android.sec.clipboard.ClipboardExManager#418e1fb0
10-31 22:05:32.393: W/Ads(11349): Failed to load ad: 1
10-31 22:05:32.403: D/WebView(11349): onSizeChanged - w:480 h:75
10-31 22:05:32.443: V/webkit(11349): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {418da9a8}
Here is the relevant code from the xml:
<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="MY UNIT ID HERE (hidden)"/>
And the relevant code from my .java file:
AdView adView = (AdView)rootView.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("MY DEVICE ID HERE (hidden)").build();
adView.loadAd(adRequest);
I hope you guys can help me out here!
Your code looks fine. But I wonder what version of Android (or device) you deployed to to get the log above.
10-31 22:05:32.313: W/Ads(11349): There was a problem getting an ad response. ErrorCode: 1
10-31 22:05:32.323: I/dalvikvm(11349): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.ads.internal.o.a.evaluateJavascript
10-31 22:05:32.323: W/dalvikvm(11349): VFY: unable to resolve virtual method 3227: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
These log lines seem to indicate that Admob was looking for a WebKit method that doesn't exist in your Android environment.
The Google Play versions of Admob (which you seem to be using) only support Gingerbread and up.

Issues with Google Play Game Services occupying Android Res folder & Web API alternative?

So we're in the middle of development of our Unity based game for Android. We had Facebook authentication already implemented and this makes use of the Android/Res folder. It stores some values and images there.
While trying to implement Google Play SDK for Authentication, Leaderboards, Achievements.... we came to realize it too makes use of the Android/Res folder which apparently causes a crash and not currently possible.
We're curious about 2 options
1) is there any possible way to allow 2 different services to make use of the Android resource system? Please note we're using Unity, and the plugin is made by Prime31.
If the source for the library is released then it could be possible to modify so the resource folder isn't used.
2) If we're stuck not being able to have Facebook and Google Play Services co-exist then is the entire process possible via REST JSON access? How is the Google+ sign in performed with our app launching a browser or Google+ app to securely take in credentials?
See our error log below
W/PopupManager(11358): You have not specified a View to use as content view for popups. Falling back to the Activity content view which may not work properly in future versions of the API. Use setViewForPopups() to set your content view.W/dalvikvm(11358): VFY: unable to resolve static field 1994 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0041
W/dalvikvm(11358): VFY: unable to resolve static field 1990 (common_google_play_services_enable_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x004c
W/dalvikvm(11358): VFY: unable to resolve static field 2000 (common_google_play_services_update_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0057
W/dalvikvm(11358): VFY: unable to resolve static field 1997 (common_google_play_services_unsupported_title) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0069
W/dalvikvm(11358): VFY: unable to resolve static field 1991 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0009
W/dalvikvm(11358): VFY: unable to resolve static field 1988 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0010
W/dalvikvm(11358): VFY: unable to resolve static field 1998 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0017
W/dalvikvm(11358): VFY: unable to resolve static field 1995 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
D/dalvikvm(11358): VFY: replacing opcode 0x60 at 0x0004
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07c9 at 0x18 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07c8 at 0x38 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07c5 at 0x3f in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07cf at 0x46 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
I/dalvikvm(11358): DexOpt: unable to optimize static field ref 0x07cc at 0x66 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.b
D/Prime31 (11358): onConnectionFailed: result 4
D/Prime31 (11358): onConnectionFailed: since user didn't initiate sign-in, failing now.
D/dalvikvm(11358): GC_CONCURRENT freed 430K, 5% free 9477K/9936K, paused 2ms+2ms, total 27ms
I/Unity (11358): authenticationFailedEvent: Unknown error
I/Unity (11358):
I/Unity (11358): (Filename: ./Runtime/ExportGenerated/AndroidManaged/UnityEngineDebug.cpp Line: 54)
I/Unity (11358):
E/Prime31 (11358): Exception running command on UI thread: Not connected. Call connect() and wait for onConnected() to be called.
D/dalvikvm(11358): GC_CONCURRENT freed 385K, 5% free 9477K/9936K, paused 2ms+2ms, total 27ms
D/dalvikvm( 6765): GC_CONCURRENT freed 417K, 7% free 9483K/10172K, paused 7ms+2ms, total 32ms
E/Prime31 (11358): Exception running command on UI thread: Not connected. Call connect() and wait for onConnected() to be called.
D/dalvikvm(11358): GC_CONCURRENT freed 385K, 5% free 9478K/9936K, paused 2ms+2ms, total 29ms
D/dalvikvm(11358): GC_CONCURRENT freed 387K, 5% free 9478K/9936K, paused 6ms+1ms, total 62ms
D/Prime31 (11358): isGooglePlayServicesAvailable returned 0
D/Prime31 (11358): beginUserInitiatedSignIn: continuing pending sign-in flow.
D/Prime31 (11358): resolveConnectionResult: trying to resolve result: ConnectionResult{statusCode=SIGN_IN_REQUIRED, resolution=PendingIntent{423c8fe8: android.os.BinderProxy#423c8f88}}
D/Prime31 (11358): --------------------- result has resolution. Starting it. --------------------
I/ActivityManager( 506): START u0 {cmp=com.phyken.wizardopstactics/com.prime31.PlayServicesProxyActivity} from pid 11358
D/dalvikvm(11358): GC_CONCURRENT freed 384K, 5% free 9481K/9936K, paused 5ms+4ms, total 80ms
1) There isn't any problem in two services using the resources folder. All the resources will be on the final APK, just pay attention on the resources names so they don't conflict. The best practice is to use a suffix (example: fb_logo.png and google_logo.png, instead of two logo.png images)
2) Not needed!
If you posted the error log it would have been easier to help and point the exact issue!

Categories

Resources