android_asset not working on Honeycomb?

I have a shipping Android application that displays occasional static webpages that are included in the assets folder. I have been displaying these programmatically like:

webView = new WebView(PKBDocument.KnowledgeBook.KBContext); setContentView(webView); webView.loadUrl("file:///android_asset/path/to the/file.html");

This works fine for API levels 3 - 9. I just recently received my shiny new Xoom and tried running the same app, and I get an error

The webpage at file:///android_asset/path/to%20the/file.html might be temporarily down or it may have moved permanently to a new web address

So, I started experimenting. The Honeycomb emulator displays these pages just fine, but my actual honeycomb device (running 3.0.1) consistently displays this error. I can read the webpage with AssetManager and then display it using loadDataWithBaseURL(), but then the image links in the web page don't load (presumably because it can't find the path to the image file).

Any idea what changed, and how to handle this?

-------------Problems Reply------------

Try removing the space. This project and this project both work fine on my XOOM.

For me the problem was that I compiled with maven. With maven your assets should go into src/main/resources/assets and I had them in src/main/resources — which apparently is wrong.

It seems that Honeycomb stricter about this. If you don't use Maven then make a listing of the files in your apk file (it is just as zip file) and check that your assets correcty inside the asset directory:

7z l target/*.jar

7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=utf8,Utf16=on,HugeFiles=on,8 CPUs)

Listing archive: target/HP45-Droid-5.0.0.jar

Path = target/HP45-Droid-5.0.0.jar
Type = zip
Physical Size = 465392

Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2012-01-01 19:07:10 D.... 0 0 META-INF
2012-01-01 19:07:08 ..... 125 102 META-INF/MANIFEST.MF
2012-01-01 19:07:06 D.... 0 0 assets
2012-01-01 19:07:06 ..... 93692 93629 assets/45bk.jpg
2012-01-01 19:07:06 ..... 3467 1408 assets/help.html

Category:android Views:0 Time:2011-03-19

Related post

  • Basic internal links don't work in honeycomb app? 2011-07-01

    Internal links do not seem to be working in Android version 3 in my published app. My app targets Froyo at this point. The app works fine on tons of phones, but my new Galaxy Tab can't handle the internal links!! It can handle them within an html pag

  • white space allowed as part of file path? 2011-06-25

    My question is kinda related to android_asset not working on Honeycomb? Is it allowed to have spaces in the file path name of an html page located in the assets folder? For ex: Is the following legal? mWebView = (WebView) findViewById(;

  • Webpage not available on Honeycomb webview 2011-04-13

    We have a webview that we are loading from android_assets. This works fine in 2.1, 2.2, and 2.3. However, when we load it in 3.0, we get a "Webpage not available" message. This only happens on pages where we are passing parameters to the webview: Web

  • WebView on Android ICS, iframe problems with android_assets 2012-01-29

    My application engine runs inside a WebView. It spans different IFRAMES. Both the main application html and the iframes html are on android_assets. On Android 3.x no problems ever. Same on chrome browser, etc. If I create an IFRAME (createElement -

  • Drawing an honeycomb with as3 2010-05-22

    I'm trying to create an honeycomb with as3 but I have some problem on cells positioning. I've already created the cells (not with code) and for cycled them to a funcion and send to it the parameters which what I thought was need (the honeycomb cell i

  • information about honeycomb 2011-01-18

    i find that there are only two videos that showed at CES2011 on internet and no other information about it. Such as which linux do honeycomb use. Does anyone know more about the honeycomb? thank you very much! --------------Solutions------------- You

  • Honeycomb Android emulator is dog slow - will it get manageable before the official release? 2011-01-27

    I thought the Gingerbread emulator was slow, but man - the Honeycomb emulator is so slow on a modern PC, it's practically unusable. Since Reto Meier asked to throw up our Honeycomb questions onto StackOverflow, here is mine - will it get faster any t

  • Strategies for Honeycomb & backward compatibility 2011-01-28

    So we've seen the preview sdk and the neat new stuff like ActionBar and Fragments. Making a lot of method calls will be unavoidable to make use of these, so what strategies are there for maintaining 1 version of the app, which will let me use all the

  • How do I download the Honeycomb SDK preview? 2011-01-29

    I keep getting a "File not found" error in the SDK Manager when I try to download the SDK Preview for Honeycomb. Same thing happens with both http and https. Any advice? Thanks in advance! --------------Solutions------------- Maybe this is the reason

  • Where is API call to do "lights out mode" in honeycomb? 2011-01-29

    I am working on a game and would like to have the full screen to itself. Did anyone found a way to make the app go full screen on Android Honeycomb preview emulator? --------------Solutions------------- Lights out mode has changed in the full 3.0 SDK

  • MapView in the Android 3.0 Honeycomb Preview AVD emulator? 2011-02-15

    When I push my app to a Honeycomb AVD I get this: Package com.myapp requires unavailable shared library; failing! Am I right in thinking this is because the Preview SDK only provides the AOSP SDK, and not the Google components

  • Http Live Streaming in HoneyComb crashes 2011-02-16

    I tried again this morning with the mediaPlayerVideo sample code provided with honeycomb SDK (in the APIDemo, section Media) and I got same error as before in ACodec.cpp. Does it mean that Apple HTTP Streaming is not yet fixed in the preview ??? Did

  • Can i hide the App Icon from the Action Bar in Honeycomb? 2011-02-17

    I am currently planning the honeycomb update for my app and i am wondering how to use the Action Bar correctly. My first question is if it is possible to hide the App-Icon and Title from the Action Bar. And is there any kind of Design guidline for th

  • HoneyComb activity preview showing 5 activities in one screen 2011-02-21

    I would like to open an activity which in turns uses startActivityForResult window and opens, let us assume, 5 activities. So in the UI I would like it to display using the format present in the attached screen shot format. See the attached honeycomb

  • Why isn't graphics acceleration turned on by default in Honeycomb? 2011-02-23

    Why isn't graphics acceleration turned on by default in Honeycomb? Are there any situations when it's better to leave it disabled? --------------Solutions------------- It is not turned on by default for compatibility reasons. Not 100% of the Canvas A

  • Setting the holographic theme in Honeycomb 2011-02-23

    I saw this post about using the new holographic themes on Honeycomb: Change theme according to android version In my app, I have minSdkVersion="11" and targetSdkVersion="11". By default, I get a solid black background with light text. If I explicitly

  • StackView in Android 3.0 HoneyComb 2011-02-23

    Can any one provide any example of StackView in Android 3.0 HoneyComb , it wll be a gr8 help for me .. thnxxx.... --------------Solutions------------- You can find a very basic tutorial on StackView here:

  • Can Honeycomb Loaders solve problems with AsyncTask + UI update? 2011-02-23

    Doing something in background and then updating UI is very hard to implement correctly in Android. It's simply badly designed. Typical example is an AsyncTask that fetches something from the web and displays the result. There are 2 problems with this

  • Does using the ActionBar in Honeycomb really mean i have to create an extra App? 2011-02-24

    Last week i began the honeycomb update for my app and since then the documentation has become available. One of the really big things to change in my app is the use of the ActionBar. I am a little disappointed about the following sentence from the do

Copyright (C), All Rights Reserved.

processed in 0.211 (s). 11 q(s)