I submitted a bug to 0.10 around 2 days ago, where NPE was thrown when 
using ${packageName} 
-> https://groups.google.com/forum/#!topic/adt-dev/MV_9qu4BW1g

As you said, it's already fixed in 0.10.1, and indeed it is, though I found 
another issue with manifest merging.

Suppose you have something like this in your AndroidManifest.xml, notice 
<uses-permission> order:

<manifest xmlns:android="http://schemas.android.com/apk/res/android";
          package="pl.pkobp.iko2">

    <!-- Google Cloud Messaging -->
    *<uses-permission android:name="android.permission.GET_ACCOUNTS"/>*
*    <uses-permission android:name="android.permission.WAKE_LOCK"/>*
*    <uses-permission 
android:name="com.google.android.c2dm.permission.RECEIVE"/>*


*    <uses-permission android:name="${packageName}.permission.C2D_MESSAGE" 
/>*

*    <permission android:name="${packageName}.permission.C2D_MESSAGE"*
*                android:protectionLevel="signature" />*
    <!-- /Google Cloud Messaging -->
[...]
</manifest>

When you try to assemble such, you'll face

Caused by: java.lang.IndexOutOfBoundsException:* Illegal start index*
at 
com.android.utils.PositionXmlParser.getPosition(PositionXmlParser.java:354)
at 
com.android.utils.PositionXmlParser.getPosition(PositionXmlParser.java:301)
at com.android.manifmerger.XmlDocument.getNodePosition(XmlDocument.java:157)
at com.android.manifmerger.XmlAttribute.getPosition(XmlAttribute.java:101)
at 
com.android.manifmerger.ActionRecorder.recordAttributeAction(ActionRecorder.java:203)
at 
com.android.manifmerger.PlaceholderHandler.visit(PlaceholderHandler.java:85)
at 
com.android.manifmerger.PlaceholderHandler.visit(PlaceholderHandler.java:96)
at 
com.android.manifmerger.PlaceholderHandler.visit(PlaceholderHandler.java:62)

Seems like problem is with <uses-permission> order. Those tags which uses 
${packageName} have to be first, so hereby I put AndroidManifest.xml which 
doesn't cause this error:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
          package="pl.pkobp.iko2">


    <!-- Google Cloud Messaging -->
  *  <uses-permission android:name="${packageName}.permission.C2D_MESSAGE" 
/>*

*    <permission android:name="${packageName}.permission.C2D_MESSAGE"*
*                android:protectionLevel="signature" />*
*    <uses-permission android:name="android.permission.GET_ACCOUNTS"/>*
*    <uses-permission android:name="android.permission.WAKE_LOCK"/>*
*    <uses-permission 
android:name="com.google.android.c2dm.permission.RECEIVE"/>*
[...]
</manifest>

It's not a blocker, but it took me a few hours to find the cause of this 
problem, so I'll post it for others who'll face it. Would you guys fix it 
soon?

M.

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to