0

I'm having a little problem trying to figure out how to set up maps on my android app that uses Transfuse framework.

Since I didn't see anything in the examples and documentation regarding maps, I tried to follow this tutorial: http://www.vogella.com/articles/AndroidGoogleMaps/article.html

Unfortunately when I get to add the metadata:

@MetaData(name = "com.google.android.maps.v2.API_KEY", value = "my_key")

I get: error: No resource identifier found for attribute 'resourceSpecification' in package 'android'

Looking at my manifest (that transfuses auto generates) I see it creates that 'resourceSpecification' attribute which I think it should be called just 'resource', but still I did not define any resource so it shouldn't be added, right?

<meta-data t:tag="+,n,s,v" android:name="com.google.android.maps.v2.API_KEY" android:resourceSpecification="" android:value="my_key"/>

I confess I'm a little lost when it comes to "converting" regular manifest set up to the Transfuse way, another example:

<permission
    android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />
<uses-permission android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

How would I set this up? (I guess that's topic for another question, but still Map related)

Any help would be appreciated :) thanks!

Gustavo Matias
  • 3,508
  • 3
  • 27
  • 30
  • It looks like this is a bug. Not only is resourceSpecification misnamed (did this change recently?), but it is added to the manifest when it is blank. I've issued a fix for this and have pushed out a bug fix to maven central. Update to version 0.2.3-SNAPSHOT and give it another try. I'll push out 0.2.3 when you confirm this fixes it (https://github.com/johncarl81/transfuse/issues/48). If it still won't build you may have to delete the tag to transfuse generates it fresh. – John Ericksen Oct 13 '13 at 17:01
  • Thanks! for some reason I can't pull the snapshot version from anywhere, is it supposed to be showing here? http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.androidtransfuse%22 – Gustavo Matias Oct 14 '13 at 00:40
  • You may have to add the maven central snapshot repository: http://stackoverflow.com/questions/7713996/is-there-a-way-to-make-maven-download-snapshot-versions-automatically. here's the Transfuse snapshots: https://oss.sonatype.org/content/repositories/snapshots/org/androidtransfuse/transfuse/ – John Ericksen Oct 14 '13 at 01:59
  • Got it! so now when I run maven I get: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project my-android-project: Fatal error compiling: java.lang.NoClassDefFoundError: org/androidtransfuse/util/Namer: org.androidtransfuse.util.Namer -> [Help 1] – Gustavo Matias Oct 14 '13 at 04:56
  • Did you update the android-api version to the same 0.2.3-SNAPSHOT version? – John Ericksen Oct 14 '13 at 12:46
  • Beautiful! it worked! I can see the manifest with the metadata properly set :) thanks a lot! now I can continue with my map integration, anything on the doc that teaches how to use permission + uses-permission? – Gustavo Matias Oct 15 '13 at 00:21
  • Great! Im glad that worked for you. I'll issue a 0.2.3 release soon so you can rely on a non-SNAPSHOT. Reviewing the docs it looks like we're missing the (at)Permissions and (at)UsesPermission annotations. I'll add those to the docs soon. – John Ericksen Oct 15 '13 at 14:34
  • thanks a lot for the support! I'm really enjoying using Transfuse, hopefully my doubts will help others and make it become a more successful android framework :) – Gustavo Matias Oct 15 '13 at 14:55

1 Answers1

1

This was a bug prior to 0.2.3.

In terms of the <permission> and <uses-permission> you should be able to use the @Permission and @UsesPermission annotations on the @TransfuseModule configuration class:

@TransfuseModule
@Permission(name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE", protectionLevel=ProtectionLevel.SIGNATURE)
@UsesPermission({
        "com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE",
        Manifest.permission.INTERNET,
        Manifest.permission.WRITE_EXTERNAL_STORAGE})
public class Module{}

produces the following:

<permission
    android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />
<uses-permission android:name="com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
John Ericksen
  • 10,995
  • 4
  • 45
  • 75