barterli / barterli_android

android app for barter.li
Apache License 2.0
40 stars 25 forks source link

Android Studio Error with crashlytics #89

Closed imran0101 closed 10 years ago

imran0101 commented 10 years ago

If you come across this error at compile time.

ERROR - Crashlytics Developer Tools error. java.lang.IllegalArgumentException: Crashlytics found an invalid API key: @string/crashlytics_id. ... Error:Execution failed for task ':barterli:crashlyticsCleanupResourcesDebug'.

Crashlytics Developer Tools error.

Solution

Just replace @string/crashlytics_id with the actual key.

<meta-data
            android:name="com.crashlytics.ApiKey"
            android:value="@string/crashlytics_id" />
vinaysshenoy commented 10 years ago

Alright, got it. Will merge this in tonight.

On Fri, Jun 27, 2014 at 1:21 PM, Imran notifications@github.com wrote:

If you come across this error at compile time.

Error:Execution failed for task ':barterli:crashlyticsCleanupResourcesDebug'.

Crashlytics Developer Tools error.

Just replace @string/crashlytics_id with the actual key.

<meta-data android:name="com.crashlytics.ApiKey" android:value="@string/crashlytics_id" />

— Reply to this email directly or view it on GitHub https://github.com/barterli/barterli_android/issues/89.

Vinay S Shenoy Professional Android App Developer, Amateur Game Developer +91-9538122356 | vinaysshenoy@gmail.com LinkedIn : http://in.linkedin.com/in/vinaysshenoy

imran0101 commented 10 years ago

Just keeping a record of the issue.

You can close this since the solution is provided.

vinaysshenoy commented 10 years ago

Ok, the crashlytics problem is causing issues. If we include the key as a string resource in api_keys.xml, the plugin doesn't seem to read the string resource. Instead it literally takes "@string/crashlytics_key" as the crashlytics ID. Any ideas how to fix this? We can't add the string resource directly, since we shouldn't be uploading our crashlytics key to Github.

imran0101 commented 10 years ago

Crashlytics is trying to read the api_key parsing the manifest file from the directory during compile time. It does find the the that matches what it stores.

The id is not read a Android Resource. I contacted the Crashytics support team. We are working on it together.

Facebook reads it at runtime.

Will update the thread on this.

imran0101 commented 10 years ago

Worked on lot of workarounds.

Multiple Manifests and stuff. It is hard to manage multiple Manifests.

I just worked out a solution to remove the error from compile time.

Disable crashlytics plugin in build.gradle.

More on #90

vinaysshenoy commented 10 years ago

Awesome, but that's a lot of work to work around something. I don't know why the Crashlytics team went for this convoluted way of installing the SDK instead of doing something like the others do.

In any case, this doesn't resolve the core issue that the Crashlytics key will still be pushed to Github - https://github.com/mipreamble/barterli_android/blob/10eab60e06731504ad1d7cb495314e8267012078/barterli/src/main/AndroidManifest.custom.xml

We'll need to do something similar here like we do with api_keys.xml.

Second, this pull request has the same problem has the original. Please give it to android-studio-migration after rebasing your commits.

imran0101 commented 10 years ago

Manifest was the work around the Crashlytics team suggested. But I did not want to work with 2 manifest. So I disabled the plugin in build.gradle https://github.com/mipreamble/barterli_android/blob/crashlytics_plugin/barterli/build.gradle#L13 Just the above edit.

The key is still in the api_keys.xml https://github.com/mipreamble/barterli_android/tree/crashlytics_plugin/barterli/src/main

AndroidManifest.custom.xml was removed later on. I refreshed my key. No problem. The support team wanted to see the code.

You must have picked the wrong link. https://github.com/barterli/barterli_android/pull/90 Commit here are in order I guess. I pulled the branch and fetched everything before edit.

One more thing https://github.com/mipreamble/barterli_android/blob/crashlytics_plugin/barterli/src/main/java/li/barter/BarterLiApplication.java#L91

The BuildConfig in the above line does not seem to pick up.

vinaysshenoy commented 10 years ago

Oh right, yes! I see now.

The BuildConfig took a few minutes for me to get updated too. After that it was available. I'm planning to use the same for configuring server urls since it's much more convenient.

Yes, and the target branch is still master. It needs to be android-studio-migration :-)

imran0101 commented 10 years ago

@vinaysshenoy I did not get you.

Is something incomplete that should be done here? Do let me know.

Thanks.

vinaysshenoy commented 10 years ago

Just that the pull request's target branch is master. It should be android-studio-migration.

imran0101 commented 10 years ago

91 That should resolve it.

Please test everything. I would like to start closing issues. Haven't done any real work yet.

Thanks.

vinaysshenoy commented 10 years ago

Done! I've tested the build and it seems to be working. The only problem now seems to be the crashlytics issue, which we can work around by enabling the plugin and pasting the key during release time only! Hopefully, they fix this soon.

Thanks for all the work. If you do take up any issue, please assign it to yourself so we can track them.

imran0101 commented 10 years ago

Will do. Thanks.

Let me know if their is anything you want me to look at currently.

I was thinking of write test cases for the application. Robolectric or any other library you want to use.

vinaysshenoy commented 10 years ago

Test cases sounds great. I was also going to work on refactoring and decoupling the business logic out of the fragments and Activities, so testing should tie in well with that. On Jun 29, 2014 8:36 AM, "Imran" notifications@github.com wrote:

Will do. Thanks.

Let me know if their is anything you want me to look at currently.

I was thinking of write test cases for the application. RoboElectric or any other library you want to use.

— Reply to this email directly or view it on GitHub https://github.com/barterli/barterli_android/issues/89#issuecomment-47444602 .

imran0101 commented 10 years ago

Alrite.

Robolectric ?

vinaysshenoy commented 10 years ago

Perfect. On Jun 29, 2014 8:42 AM, "Imran" notifications@github.com wrote:

Alrite.

— Reply to this email directly or view it on GitHub https://github.com/barterli/barterli_android/issues/89#issuecomment-47444643 .