How to handle private data in Android Studio Projects?

Viewed 613

I'm currently developing an app and I want to make it open source. But it uses some data I don't want to share, such as signing configs or api credentials and so on.

I found a solution for signing configs in this post. There the signing config data is extracted and stored outside of the repo and can be applied using "apply from" in build script.

Now I had the idea to inject my sensitive data the same way using build script extra properties, metadata or buildconfig variables. But they don't get applied. I found some older blogposts where it's done this way, but I also found some resouces saying gradle changed to not allow it any more. So that's what I discovered: I can inject everything when it's defined in my build.gradle, but as soon as I want to inject it from an external gradle file it doesn't work any more.

I know, I can define additional source folders which are outside the repositiory, but that will prevent others from building the project when they fork my repo.

So my question is: What's the best approach to have an open source project, but use private data to build and publish the project using some private data needed to run it properly? I'm using Android Studio 1.5.1 and build tools 23.0.2.

2 Answers
Related