开发者

"Resource not found" when building Android app under IntelliJ 9.0 Maia Public Beta

I'm trying to port an app from Eclipse to IntelliJ. The app builds fine but it fails to run properly.

Here's a partial stack trace I receive:

ERROR/AndroidRuntime(957):             
java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" ClassLoader: dalvik.system.PathClassLoader@43761190
        at org.joda.time.tz.ZoneInfoProvider.openResource(ZoneInfoProvider.java:209)
        at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:123)
        at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:82)
        at org.joda.time.DateTimeZone.getDefaultProvider(DateTimeZone.java:439)
        at org.joda.time.DateTimeZone.setProvider0(DateTimeZone.java:393)
        at org.joda.time.DateTimeZone.<clinit>(DateTimeZone.java:114)
        at org.joda.time.chrono.GregorianChronology.<clinit>(GregorianChronology.java:71)
        at org.joda.time.chrono.ISOChronology.<clinit>(ISOChronology.java:66)
        at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:97)
        at org.joda.time.DateTime.<init>(DateTime.java:120)

For some reason, the app isn't able to find the joda-time resources, even though they're specified in the module's build path. These are the same jarfiles used by the eclipse version of the app.

alt text http://img.skitch.com/20091106-pgqujbb5eaeqc2wfiqc2c1p39a.png

The APK built by the IntelliJ tool is about 20% smaller than the one built by Eclipse, but I don't know why.

开发者_如何学Python

Any idea what might be the problem?

UPDATE:

I spoke with romain and xav yesterday, and it appears that the problem is that intellij is not bundling resources into the apk. Evidently aapt does a two pass approach - first it bundles all the class files into a .dex file, and then it bundles all of the resource files separately into the top level of the apk file. It's this second pass that intellij seems to be missing.

As a workaround, they suggested that I unjar all the resource files from the joda-time jar, and place them in my src directory. The expectation was that intellij would then bundle them into my apk as though they were part of my own source, thus solving the problem. However, when I did this, IntelliJ ignored those files entirely when it created the apk.

I don't know why. Is there maybe a workaround I can use to get the joda-time resource files into my apk that isn't terribly inconvenient every time I want to build?


This is a pretty old version of intellij at this point. 10.5 seems to resolve all of my issues with android dev


Isn't your problem the scope of your dependencies ? If they're only used to compile, it's not garanteed to work at Runtime is it ?

I'm not a user of IJ myself but from your screenshot that's my guess. It would also explain why the size of your android package is 80% lower.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜