I'm going to get data with Restlet of this official OData page:
http://services.odata.org/OData/OData.svc/
I've started this tutorial:
http://weblogs.asp.net/uruit/archive/2011/09/13/accessing-odata-from-android-using-restlet.aspx
My problem is, that at the end, he can't get the metadata. But first:
When I'm trying to generate the Restleg-Files (Point 5), the console is showing this, where the lines with are date are red:
---------------------------
OData client code generator
---------------------------
step 1 - check parameters
step 2 - check the ouput directory
step 3 - get the metadata descriptor
Nov 28, 2011 3:12:46 PM org.restlet.engine.http.connector.HttpClientHelper start
Information: Starting the default HTTP client
Nov 28, 2011 3:12:48 PM org.restlet.ext.odata.Service getMetadata
Information: Get the metadata for http://services.odata.org/OData/OData.svc/ at http://services.odata.org/OData/OData.svc/$metadata
Nov 28, 2011 3:12:48 PM org.restlet.engine.http.connector.HttpClientHelper start
Information: Starting the default HTTP client
step 4 - generate source code
Nov 28, 2011 3:12:48 PM org.restlet.engine.http.connector.HttpClientHelper start
Information: Starting the default HTTP client
Nov 28, 2011 3:12:49 PM org.restlet.ext.odata.Service getMetadata
Information: Get the metadata for http://services.odata.org/OData/OData.svc/ at http://services.odata.org/OData/OData.svc/$metadata
Nov 28, 2011 3:12:49 PM org.restlet.engine.http.connector.HttpClientHelper start
Information: Starting the default HTTP client
Nov 28, 2011 3:12:49 PM org.restlet.engine.http.connector.HttpClientHelper stop
Information: Stopping the default HTTP client
Nov 28, 2011 3:12:50 PM org.restlet.engine.http.connector.HttpClientHelper stop
Information: Stopping the default HTTP client
The source code has been generated in directory: C:\Projects\MyProjects\Android App\main\app\Java\Workspace\TestOData2\src
So the files are generated, but when I'm going forward in the tutorial, copy the class into my Android project, import libraries and write the following code, then I get the error below.
public ArrayList<Product> getOdataSampleProduct(String zip) {
ODataDemoService proxy = new OdataDemoService();
try {
Query<Product> query = proxy.createProductQuery("Products(1)");
Product product = query.iterator().next(); //breaks here
Log.d("Test","id: "+product.getId()); //isn't logged
}
catch(Exception e) {
//is catched before query.iterator().next()
};
So, LogCat shows this error (line 3 is red):
...
11-29 09:01:01.039: INFO/org.restlet(700): Starting the default HTTP client
11-29 09:01:01.329: INFO/org.restlet(700): A recoverable error was detected (1001), attempting again in 2000 ms.
11-29 09:01:05.589: ERROR/org.restlet(700): Can't get the metadata for http://services.odata.org/OData/OData.svc/ (response's status: Communication Error (1001) - services.odata.org)
11-29 09:01:05.629: INFO/org.restlet(700): Get the metadata for http://services.odata.org/OData/OData.svc/ at http://services.odata.org/OData/OData.svc/$metadata
11-29 09:01:06.200: INFO/org.restlet(700): Starting the default HTTP client
11-29 09:01:06.329: INFO/org.restlet(700): A recoverable error was detected (1001), attempting again in 2000 ms.
11-29 09:01:06.359: DEBUG/dalvikvm(408): GC_EXPLICIT freed 3K, 5% free 6308K/6595K, paused 3ms+2ms
11-29 09:01:08.409: INFO/org.restlet(700): A recoverable error was detected (1001), attempting again in 2000 ms.
11-29 09:01:10.499: ERROR/org.restlet(700): Can't get the metadata for http://services.odata.org/OData/OData.svc/ (response's status: Communication Error (1001) - services.odata.org)
11-29 09:01:10.579: WARN/org.restlet(700): Can't parse the content of http://services.odata.org/OData/OData.svc/Products(1)
11-29 09:01:10.579: WARN/org.restlet(700): java.lang.Exception: Can't execute the query without the service's metadata.
11-29 09:01:10.579: WARN/org.restlet(700): at org.restlet.ext.odata.Query.execute(Query.java:347)
11-29 09:01:10.579: WARN/org.restlet(700): at org.restlet.ext.odata.Query.iterator(Query.java:642)
11-29 09:01:10.579: WARN/org.restlet(700): at my.folder.testApp.MapView.getData(MapView.java:77)
11-29 09:01:10.579: WARN/org.restlet(700): at my.folder.testApp.MapView.onCreate(MapView.java:141)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.Activity.performCreate(Activity.java:4397)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.ActivityThread.access$500(ActivityThread.java:122)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
11-29 09:01:10.579: WARN/org.restlet(700): at android.os.Handler.dispatchMessage(Handler.java:99)
11-29 09:01:10.579: WARN/org.restlet(700): at android.os.Looper.loop(Looper.java:132)
11-29 09:01:10.579: WARN/org.restlet(700): at android.app.ActivityThread.main(ActivityThread.java:4123)
11-29 09:01:10.579: WARN/org.restlet(700): at java.lang.reflect.Method.invokeNative(Native Method)
11-29 09:01:10.579: WARN/org.restlet(700): at java.lang.reflect.Method.invoke(Method.java:491)
11-29 09:01:10.579: WARN/org.restlet(700): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
11-29 09:01:10.579: WARN/org.restlet(700): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
11-29 09:01:10.579: WARN/org.restlet(700): at dalvik.system.NativeStart.main(Native Method)
It seems that there is a problem with the metadata, but I can't figure out what.
Any idea?
Could you try registering the Restlet extension for Apache HTTP Client instead of the default internal connector?
See this page for details:
http://wiki.restlet.org/docs_2.1/13-restlet/275-restlet/266-restlet.html
At least, I've found a solution:
I had to put the query into an AsyncTask.
Before, in the UI thread, the query didn't have time to get an answer.
So I put it into the doInBackground.
Related
I am developing an android app , I want to show banner ads in my app .My previous apps works correctly and the ads are shown . When I create my new app ads did not show even in the old apps
it shows ads failed to load ad:3
this what is shown in the logcat
11-29 18:52:54.831: D/ViewRootImpl(31298): ViewPostImeInputStage processPointer 0
11-29 18:52:54.921: D/ViewRootImpl(31298): ViewPostImeInputStage processPointer 1
11-29 18:52:54.921: I/Timeline(31298): Timeline: Activity_launch_request id:apps.s.r.sh time:126574535
11-29 18:52:54.951: W/ResourcesManager(31298): getTopLevelResources: /data/app/apps.s.r.sh-1/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:54.951: W/ResourcesManager(31298): getTopLevelResources: /data/app/apps.s.r.sh-1/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:55.241: D/SecWifiDisplayUtil(31298): Metadata value : none
11-29 18:52:55.251: D/ViewRootImpl(31298): #1 mView = com.android.internal.policy.PhoneWindow$DecorView{b1e1489 I.E...... R.....ID 0,0-0,0}
11-29 18:52:55.571: W/DisplayListCanvas(31298): DisplayListCanvas is started on unbinded RenderNode (without mOwningView)
11-29 18:52:55.591: D/ViewRootImpl(31298): MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
11-29 18:52:55.851: I/Timeline(31298): Timeline: Activity_idle id: android.os.BinderProxy#1308390 time:126575466
11-29 18:52:55.861: V/ActivityThread(31298): updateVisibility : ActivityRecord{c3eecaf token=android.os.BinderProxy#2057663 {apps.s.r.sh/apps.s.r.sh.MainActivity}} show : false
11-29 18:52:56.921: D/ViewRootImpl(31298): ViewPostImeInputStage processPointer 0
11-29 18:52:56.991: D/ViewRootImpl(31298): ViewPostImeInputStage processPointer 1
11-29 18:52:57.001: I/Timeline(31298): Timeline: Activity_launch_request id:apps.s.r.sh time:126576611
11-29 18:52:57.031: W/ResourcesManager(31298): getTopLevelResources: /data/app/apps.s.r.sh-1/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.031: W/ResourcesManager(31298): getTopLevelResources: /data/app/apps.s.r.sh-1/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.081: W/ResourcesManager(31298): getTopLevelResources: /data/app/com.google.android.gms-1/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.261: W/DynamiteModule(31298): Failed to load module via V2: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.dynamite.DynamiteModule$DynamiteLoaderClassLoader" on path: DexPathList[[zip file "/data/app/apps.s.r.sh-1/base.apk"],nativeLibraryDirectories=[/data/app/apps.s.r.sh-1/lib/arm, /vendor/lib, /system/lib]]
11-29 18:52:57.271: I/DynamiteModule(31298): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:10900
11-29 18:52:57.271: I/DynamiteModule(31298): Selected remote version of com.google.android.gms.ads.dynamite, version >= 10900
11-29 18:52:57.311: W/ResourcesManager(31298): getTopLevelResources: /data/app/com.google.android.gms-1/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.371: W/System(31298): ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000094/n/armeabi-v7a
11-29 18:52:57.371: W/System(31298): ClassLoader referenced unknown path: /data/data/com.google.android.gms/app_chimera/m/00000094/n/armeabi
11-29 18:52:57.381: W/ResourcesManager(31298): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000094/AdsDynamite.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.391: W/ResourcesManager(31298): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000094/AdsDynamite.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.391: D/DynamitePackage(31298): Instantiated singleton DynamitePackage.
11-29 18:52:57.391: D/DynamitePackage(31298): Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
11-29 18:52:57.531: I/Ads(31298): Updating ad debug logging enablement.
11-29 18:52:57.541: I/Ads(31298): Use AdRequest.Builder.addTestDevice("5165705B1A22CACD4E59EB67DC3FCE56") to get test ads on this device.
11-29 18:52:57.621: W/Ads(31298): Invoke Firebase method getInstance error.
11-29 18:52:57.621: W/Ads(31298): The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date
11-29 18:52:57.631: W/DynamiteModule(31298): Failed to load module via V2: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.dynamite.DynamiteModule$DynamiteLoaderClassLoader" on path: DexPathList[[zip file "/data/app/apps.s.r.sh-1/base.apk"],nativeLibraryDirectories=[/data/app/apps.s.r.sh-1/lib/arm, /vendor/lib, /system/lib]]
11-29 18:52:57.641: I/DynamiteModule(31298): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:10900
11-29 18:52:57.641: I/DynamiteModule(31298): Selected remote version of com.google.android.gms.ads.dynamite, version >= 10900
11-29 18:52:57.641: I/WebViewFactory(31298): Loading com.google.android.webview version 70.0.3538.110 (code 353811000)
11-29 18:52:57.661: W/ResourcesManager(31298): getTopLevelResources: /data/data/com.google.android.gms/app_chimera/m/00000094/AdsDynamite.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.661: D/SecWifiDisplayUtil(31298): Metadata value : none
11-29 18:52:57.661: D/ViewRootImpl(31298): #1 mView = com.android.internal.policy.PhoneWindow$DecorView{4488dba I.E...... R.....ID 0,0-0,0}
11-29 18:52:57.681: W/Ads(31298): Update ad debug logging enablement as false
11-29 18:52:57.751: W/ResourcesManager(31298): getTopLevelResources: /data/app/com.google.android.webview-2/base.apk / 1.0 running in apps.s.r.sh rsrc of package null
11-29 18:52:57.761: D/ViewRootImpl(31298): MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
11-29 18:52:57.771: W/DisplayListCanvas(31298): DisplayListCanvas is started on unbinded RenderNode (without mOwningView)
11-29 18:52:57.791: I/Timeline(31298): Timeline: Activity_idle id: android.os.BinderProxy#e9b4ee5 time:126577403
11-29 18:52:57.901: I/art(31298): Rejecting re-init on previously-failed class java.lang.Class<hs>
11-29 18:52:57.901: I/art(31298): Rejecting re-init on previously-failed class java.lang.Class<hs>
11-29 18:52:57.921: V/ActivityThread(31298): updateVisibility : ActivityRecord{47d0972 token=android.os.BinderProxy#1308390 {apps.s.r.sh/apps.s.r.sh.First}} show : false
11-29 18:52:57.921: I/cr_LibraryLoader(31298): Time to load native libraries: ? ms (timestamps ????-????)
11-29 18:52:57.991: I/chromium(31298): [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
11-29 18:52:57.991: I/cr_LibraryLoader(31298): Expected native library version number "70.0.3538.110", actual native library version number "70.0.3538.110"
11-29 18:52:58.821: I/Ads(31298): Ad failed to load : 3
The app is workimg but the ads is not showing!
You just need to wait 3-5 days.
You can check this link
It simply says that your code is correct. The issue is that AdMob does
not always have an ad to return for every request. This may happen
particularly if you have just registered your AdMob publisher ID, as
it takes some time and multiple requests before the new ID starts
returning ads.
Wait for some time may be you have just created you ad id's, but if this is not the case
then try changing app package name i.e application ID
How to Change Android App Package Name?
To change Package name of an android app, go to the Project window,
right click on the app, then select Open Module Settings,
A new window will appear, select the Flavours tab in the window.
this is where we will change the app package name i.e application
id renaming it to anything just follow the syntax
Actually i couldnt understand the solution, if you change the package name in code, you should also change the app in play console because google wants all the releases might have same package name. Did you create new app in console? #Sh R S
If you are getting this error code 3, then your code is correct. The issue is that AdMob does not always have an ad to return for every request. ... Another reason your fill rate may be low is that you don't have AdSense backfill enabled, or you have filtered out some ads. Check your app settings to see if that is the case
My problem was solved by changing the package name by:
1- right click in the project
2- android tools
3- rename application package
check the manifest to make sure that the package name was changed
then :
project---> clean
I created an AVD with the properties below to emulate a customer's device. Each time I start it up, it gives the "Unfortunately, System UI stopped" dialog and, when dismissed, the "Unfortunately, Launcher stopped." dialog.
Tweaking the parameters (at least, those which don't alter the essential characteristics of the device) using advice from:
Android emulator error: "System UI has stopped"
Unfortunately System UI has stopped
Android 4.0 emulator always has a crashing Launcher?
https://daviddesmet.wordpress.com/2013/07/26/android-avd-unfortunately-system-ui-has-stopped/
results in the same outcome.
Variations tried
skin 320x320, 320x321
Google API / non Google API
heapsize 16, 32, 64, 128
mainkeys yes, no
keyboard yes, no
ncore 1, 2, 4
I'm eventually going to borrow a device but hope to get a head start on things before the project start date so would be extremely grateful to hear of any workarounds other than those already attempted.
config.ini
Name: 3.0_Motorola_MC3200_API_16
CPU/ABI: Google APIs Intel Atom (x86)
Path: C:\Users\me\.android\avd\3.0_Motorola_MC3200_API_16.avd
Target: google_apis [Google APIs] (API level 16)
Skin: 320x320
SD Card: C:\Users\me\.android\avd\3.0_Motorola_MC3200_API_16.avd\sdcard.img
hw.dPad: no
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: 3.0" Motorola MC3200
vm.heapSize: 128
skin.dynamic: yes
hw.device.manufacturer: User
hw.gps: no
hw.initialOrientation: Portrait
skin.path.backup: _no_skin
image.androidVersion.api: 16
hw.audioInput: yes
image.sysdir.1: system-images\android-16\google_apis\x86\
hw.keyboard.lid: yes
tag.id: google_apis
showDeviceFrame: no
hw.camera.back: emulated
hw.mainKeys: yes
AvdId: 3.0_Motorola_MC3200_API_16
hw.camera.front: emulated
hw.lcd.density: 160
avd.ini.displayname: 3.0 Motorola MC3200 API 16
hw.gpu.mode: auto
hw.device.hash2: MD5:799ea57969b556677321dbf45a563939
hw.ramSize: 1024
hw.trackBall: no
hw.battery: yes
hw.cpu.ncore: 4
hw.sdCard: yes
tag.display: Google APIs
runtime.network.latency: none
hw.keyboard: yes
hw.sensors.proximity: no
disk.dataPartition.size: 800M
hw.sensors.orientation: no
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
Logcat extract: System UI stopped
01-23 12:31:05.364 1401-1453/system_process D/Tethering: MasterInitialState.processMessage what=3
01-23 12:31:11.584 1401-1414/system_process W/ActivityManager: Activity idle timeout for ActivityRecord{aedb9d20
com.android.launcher/com.android.launcher2.Launcher}
01-23 12:31:11.724 1401-1414/system_process W/ActivityManager: Launch timeout has expired, giving up wake lock!
01-23 12:31:12.234 1401-1414/system_process W/ActivityManager: Activity idle timeout for ActivityRecord{aedbcc68
com.android.launcher/com.android.launcher2.Launcher}
01-23 12:31:21.514 1401-1415/system_process W/ActivityManager: Timeout executing service: ServiceRecord{aedd3bc8 com.android.systemui/.SystemUIService}
01-23 12:31:21.514 1401-1415/system_process I/ActivityManager: Crashing app skipping ANR: ProcessRecord{aedd43e8 1462:com.android.systemui/u0a35}
Executing service com.android.systemui/.SystemUIService
01-23 12:31:21.584 1401-1414/system_process W/ActivityManager: Activity destroy timeout for ActivityRecord{aedb9d20
com.android.launcher/com.android.launcher2.Launcher}
01-23 12:31:31.704 1158-1584/? I/SurfaceFlinger: Boot is finished (31860 ms)
01-23 12:31:31.704 1401-1434/system_process W/WindowManager: ***** BOOT TIMEOUT: forcing display enabled
01-23 12:31:41.574 1401-1489/system_process E/ThrottleService: problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats:
java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
Logcat extract: Launcher Stopped
01-23 12:29:01.332 1407-1527/system_process I/ActivityManager: Start proc com.android.launcher for activity
com.android.launcher/com.android.launcher2.Launcher: pid=1793 uid=10019 gids={1028}
01-23 12:29:01.342 1793-1793/com.android.launcher E/Trace: error opening trace file: Permission denied (13)
01-23 12:29:01.352 1793-1793/com.android.launcher I/ActivityThread: Pub com.android.launcher2.settings: com.android.launcher2.LauncherProvider
01-23 12:29:01.372 1793-1793/com.android.launcher W/ResourceType: Failure getting entry for 0x7f03000d (t=2 e=13) in package 0 (error -75)
01-23 12:29:01.372 1793-1793/com.android.launcher D/AndroidRuntime: Shutting down VM
01-23 12:29:01.372 1793-1793/com.android.launcher W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xae6de228)
01-23 12:29:01.372 1793-1793/com.android.launcher E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.android.launcher/com.android.launcher2.Launcher}: android.content.res.Resources$NotFoundException: Resource ID #0x7f03000d
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f03000d
at android.content.res.Resources.getValue(Resources.java:1013)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2103)
at android.content.res.Resources.getLayout(Resources.java:852)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:256)
at android.app.Activity.setContentView(Activity.java:1867)
at com.android.launcher2.Launcher.onCreate(Launcher.java:361)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
01-23 12:29:01.392 1793-1795/com.android.launcher D/dalvikvm: GC_CONCURRENT freed 232K, 6% free 6147K/6535K, paused 11ms+0ms, total 14ms
01-23 12:29:01.392 1407-1590/system_process W/ActivityManager: Force finishing activity com.android.launcher/com.android.launcher2.Launcher
Environment
Android Studio 2.2.3
Windows 7 x64
Updates
I have removed and reinstalled SDK and Android Studio.
I am able to replicate this on 2 development machines (so far) so would be useful to discover if anyone else experiences this behaviour for this config.
I have run into a problem with playing a video from a specfic URL on Android 6.0 (sony experia mini). If I move the video to another URL I can play it. If I use a phone with Android 5.1 it works without problems.
The URL with the problem:
https://cloudadvice.blob.core.windows.net/devphotos/ff69f2ad-fd1e-48ed-9ea8-f85e65639165.mp4
Same file uploaded to dropbox (which works):
https://www.dropbox.com/s/8ftbwgavjptq9vq/ff69f2ad-fd1e-48ed-9ea8-f85e65639165%20%281%29.mp4?dl=1
I'm playing the file by writing these lines:
string videoUri = _helpRequest.VideoURL;
_videoView.SetVideoURI(Android.Net.Uri.Parse(videoUri));
I'm thinking that I've run into a bug on Android 6.0 which doesn't allow the "cloudadvice.blob.core.windows.net" in the url. Anyone tried something like this or know what might be wrong? Maybe someone got a workaround?
This is the output from the log:
06-21 11:08:46.772 D/MediaHTTPConnection(20417):
filterOutInternalHeaders: key=User-Agent, val= SonyD5803
Build/23.5.A.0.575 stagefright/1.2 (Linux;Android 6.0.1)
06-21 11:08:46.773 D/MediaHTTPConnection(20417):
filterOutInternalHeaders: key=x-wap-profile, val=
http://uaprof.sonymobile.com/D5803R2331.xml
06-21 11:08:46.774 D/MediaHTTPConnection(20417): proxy null port 0
06-21 11:08:47.113 W/MediaHTTPConnection(20417): readAt 392002 / 32768
=> java.net.ProtocolException
06-21 11:08:47.114 E/NuCachedSource2( 390): source returned error
-1010, 0 retries left 06-21 11:08:47.114 W/NuCachedSource2( 390): mFinalStatus: -1010, returning ERROR_UNSUPPORTED
06-21 11:08:47.114 E/QCExtractor( 390): ExtendedExtractor failed to
instantiate extractor
06-21 11:08:47.115 E/GenericSource( 390): Failed to init from data
source!
06-21 11:08:47.115 D/NuPlayerDriver( 390):
notifyListener_l(0xa9dc9300), (100, 1, -2147483648)
06-21 11:08:47.115 E/MediaPlayer(20417): error (1, -2147483648)
06-21 11:08:47.122 E/MediaPlayer(20417): Error (1,-2147483648)
06-21 11:08:47.122 D/VideoView(20417): Error: 1,-2147483648
I currently have a BaseAdapter that is populating a gallery of thumbnails. When an item is visible, an AsyncTask is started from the adapters getView() method to download the thumbnail and when completed the imageview is updated with the correct bitmap. This seems to work really well, except when the user scrolls really fast. This is because of the AsyncTask limitations of holding 128 threads in the queue at any given time.
So my question is how do I properly detect whether the thread pool is full before scheduling another task? Or how do I properly catch the error so I don't receive a force close?
Here are the errors I'm receiving:
5-06 10:54:11.416 27931-27931/com.diverg.tidy E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.diverg.tidy, PID: 27931
java.util.concurrent.RejectedExecutionException: Task android.os.AsyncTask$3#426c4e80 rejected from java.util.concurrent.ThreadPoolExecutor#41bddce0[Running, pool size = 5, active threads = 5, queued tasks = 128, completed tasks = 35]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2011)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:793)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1339)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:590)
at com.diverg.tidy.MediaAdapter.getView(MediaAdapter.java:90)
at android.widget.AbsListView.obtainView(AbsListView.java:2263)
at android.widget.GridView.makeAndAddView(GridView.java:1345)
at android.widget.GridView.makeRow(GridView.java:345)
at android.widget.GridView.fillDown(GridView.java:287)
at android.widget.GridView.fillFromTop(GridView.java:421)
at android.widget.GridView.layoutChildren(GridView.java:1233)
at android.widget.AbsListView.onLayout(AbsListView.java:2091)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1436)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14817)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.ListView.setupChild(ListView.java:1882)
at android.widget.ListView.makeAndAddView(ListView.java:1793)
at android.widget.ListView.fillDown(ListView.java:691)
at android.widget.ListView.fillGap(ListView.java:655)
at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5136)
at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4247)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:543)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
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)
05-06 10:54:13.299 29540-29540/? E/dalvikvm﹕ /system/priv-app/GooglePartnerSetup.apk odex has stale dependencies
05-06 10:54:19.346 8024-8024/? E/fb4a(:<default>):AddressResolver﹕ Failed to deserialize to instance com.facebook.mqtt.AddressEntry
at [Source: java.io.StringReader#42180f18; line: 1, column: 34]
05-06 10:54:20.018 125-439/? E/Netd﹕ Failed to write /sys/class/net/rmnet1/mtu: Invalid argument
05-06 10:54:20.025 447-522/? E/ConnectivityService﹕ exception in setMtu()java.lang.IllegalStateException: command '5905 interface setmtu rmnet1 1500' failed with '400 5905 Failed to get MTU (Invalid argument)'
05-06 10:54:20.369 447-1037/? E/ConnectivityService﹕ startUsingNetworkFeature took too long: 330ms
05-06 10:54:20.393 125-439/? E/Netd﹕ Failed to write /sys/class/net/rmnet1/mtu: Invalid argument
05-06 10:54:20.393 447-522/? E/ConnectivityService﹕ exception in setMtu()java.lang.IllegalStateException: command '5917 interface setmtu rmnet1 1500' failed with '400 5917 Failed to get MTU (Invalid argument)'
05-06 10:54:21.439 447-503/? E/WifiStateMachine﹕ Unexpected BatchedScanResults :OK
05-06 10:54:22.096 447-522/? E/ConnectivityService﹕ Unexpected mtu value: android.net.wifi.WifiStateTracker#423a09c0
05-06 10:54:23.932 29936-29936/? E/dalvikvm﹕ /system/priv-app/SetupWizard.apk odex has stale dependencies
05-06 10:54:24.127 29936-29936/? E/PhoneMonitor﹕ onOtaspChanged old =0, new =3
05-06 10:54:24.338 29957-29957/? E/dalvikvm﹕ /system/app/GalleryGoogle.apk odex has stale dependencies
05-06 10:54:25.127 125-439/? E/SecondaryTablController﹕ ip route del failed: /system/bin/ip route del 10.182.14.1/32 via 0.0.0.0 dev rmnet1 table 60
05-06 10:54:25.143 125-439/? E/SecondaryTablController﹕ ip route del failed: /system/bin/ip route del 0.0.0.0/0 via 10.182.14.1 dev rmnet1 table 60
05-06 10:54:25.150 125-439/? E/SecondaryTablController﹕ ip route del failed: /system/bin/ip route del 2600:1014:b10b:6554::1/128 via :: dev rmnet1 table 60
05-06 10:54:25.166 125-439/? E/SecondaryTablController﹕ ip route del failed: /system/bin/ip route del ::/0 via 2600:1014:b10b:6554::1 dev rmnet1 table 60
You can go through documentation of AsyncTask:
http://developer.android.com/reference/android/os/AsyncTask.html
And you can use getStatus() of AsyncTask to know the status of the worker thread. See http://developer.android.com/reference/android/os/AsyncTask.html#getStatus%28%29
I ended up using this as a template. It works by creating a worker thread and adding images to it's queue.
I tried to integrate google play service with my unity android game. After signed in google play service, following log message appeared in DDMS and app was crashed.
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: onConnected: connected! client=1
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: Connected clients updated to: 1
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: connectNextClient: requested clients: 1, connected clients: 1
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: Pending clients: 0
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: All clients now connected. Sign-in successful!
02-27 13:50:00.633 13419-13419/? D/AndroidNative﹕ GameHelper: All requested clients connected. Sign-in succeeded!
02-27 13:50:00.633 13419-13419/? D/AndroidRuntime﹕ Shutting down VM
02-27 13:50:00.633 13419-13419/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415baba8)
02-27 13:50:00.633 13419-13419/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.dokinkon.projectp, PID: 13419
java.lang.Error: FATAL EXCEPTION [main]
Unity version : 4.3.2f1
Device model : LGE Nexus 5
Device fingerprint: google/hammerhead/hammerhead:4.4.2/KOT49H/937116:user/release-keys
Caused by: java.lang.IllegalStateException: No AppStateClient. Did you request it at setup?
at com.google.example.games.basegameutils.GameHelper.getAppStateClient(GameHelper.java:294)
at com.android.gs.GameClientManager.onStateChange(GameClientManager.java:690)
at com.google.example.games.basegameutils.GameHelper.setState(GameHelper.java:272)
at com.google.example.games.basegameutils.GameHelper.succeedSignIn(GameHelper.java:813)
at com.google.example.games.basegameutils.GameHelper.connectNextClient(GameHelper.java:695)
at com.google.example.games.basegameutils.GameHelper.onConnected(GameHelper.java:805)
at com.google.android.gms.internal.k.y(Unknown Source)
at com.google.android.gms.internal.au.y(Unknown Source)
at com.google.android.gms.internal.k$f.a(Unknown Source)
at com.google.android.gms.internal.k$f.a(Unknown Source)
at com.google.android.gms.internal.k$b.D(Unknown Source)
at com.google.android.gms.internal.k$a.handleMessage(Unknown Source)
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)
I don't know what "java.lang.IllegalStateException: No AppStateClient. Did you request it at setup?" means for. Thanks.
You need to add the APPSTATE client as shown below:
//should be called on your application start
//best practice to call it only once. Any way other calls will be ignored by the plugin.
//if you want to use only Game service (Leader-boards, achievements) use GooglePlayConnection.CLIENT_GAMES
//if you want to use only Google Cloud service use GooglePlayConnection.CLIENT_APPSTATE
//if you want both: GooglePlayConnection.CLIENT_GAMES | GooglePlayConnection.CLIENT_APPSTATE
//and if you whant to get avaliable permissions for your app use: GooglePlayConnection.CLIENT_ALL
GooglePlayConnection.instance.start (GooglePlayConnection.CLIENT_GAMES | GooglePlayConnection.CLIENT_APPSTATE );