Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta tags required #13

Closed
RasmusKOlsen opened this issue Mar 11, 2015 · 4 comments
Closed

meta tags required #13

RasmusKOlsen opened this issue Mar 11, 2015 · 4 comments
Labels

Comments

@RasmusKOlsen
Copy link

(copy from Stuart-campbell/RushCore#1 - looks like i managed to post in a wrong repo)

Hi.

I found what seems to be either a documentation or an implementation error.

The meta tags seems to be required in the android manifest, or a null pointer is thrown:

<!-- Database name -->
<meta-data android:name="Rush_db_name" android:value="poly.danalock.db" />

<!-- Setting this to true will cause a migration to happen every launch,
this is very handy during development although could cause data loss -->
<meta-data android:name="Rush_debug" android:value="false" />

<!-- Setting this to true mean that tables will only be created of classes that
extend RushObject and are annotated with @RushTableAnnotation -->
<meta-data android:name="Rush_requires_table_annotation" android:value="false" />

The error seems to happen in AndroidRushConfig.java line 32 - it is expected that meta tags are defined within the application.

For clarity it might also be worth changing the documentation regarding these meta tags to make it clear that they should be childs of theapplication tag.

@Stuart-campbell
Copy link
Owner

Hi,

Thanks for reposting.

Yeah you are correct they need to be in the application tag. I will add a side note in the docs to make that clear.

Are you actually getting a null pointer if they are not included? All the meta-data tags should have default fall backs if not specified.

Thanks

@RasmusKOlsen
Copy link
Author

yes, if I do not include them I get a null pointer.

From a quick glance at the code it seems to be AndroidRushConfig.java at line 32, part of my stacktrace:
Caused by: java.lang.NullPointerException
at co.uk.rushorm.android.AndroidRushConfig.(AndroidRushConfig.java:32)
at co.uk.rushorm.android.RushAndroid.initialize(RushAndroid.java:29)
at co.uk.rushorm.android.RushAndroid.initialize(RushAndroid.java:23)
....MainApplication.onCreate(MainApplication.java:19)

So it happens before there is a chance for the default values be assinged.
For the record I tested it on android 4.4 using genymotion.

@Stuart-campbell
Copy link
Owner

Sounds like bundle is null at this point.

ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;

Ill put a null check in.

Thanks

Stuart-campbell added a commit that referenced this issue Mar 16, 2015
@Stuart-campbell
Copy link
Owner

Hi, Sorry I was a bit slow on this one. Resolved now.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants