Skip to content

Creating your own Baker Android Project

Francisco Contreras edited this page Aug 14, 2014 · 30 revisions

To create your own baker application for an Android environment you have compile the library and then create your own project in Android Studio.

You can check our YouTube tutorials

Or follow our guide through the steps below:

Prerequisites

Required libraries to install

From Android Studio Menu Tools > Android > SDK Manager, install the following libraries.

  • Android SDK 19
  • Android Support Repository
  • Android Support Library
  • Google Play Services
  • Google Repository

Compiling Baker Frameworks

  1. Download Baker Frameworks to your local environment (download here).
  2. From Console/Terminal (for Unix Systems) or CMD for Windows go to the "ABakerProject" folder. (if you list the files you should be able to see "gradlew").
  3. Run "gradlew install" command, if you are running on Windows it should go like this "gradlew.bat install" otherwise use "./gradlew install".

NOTE: if you ran through "Testing Baker Android" previously to this guide, before doing 'gradlew install' make sure you revert the line apply plugin: 'android' to apply plugin: 'android-library' to avoid any issues.

If this last step ran correctly you should see something like this

BUILD SUCCESSFUL
Total time: 21.441 secs

It means that Baker Frameworks for Android was installed as a library in your Maven repository wich will allow you to use it in you own project.

Creating your own Baker Android project

  1. Open Android Studio and click "New Project...".

  2. Add your applications details.

  3. Uncheck the "Create Activity" box and click "Finish".

  4. Open your project's "build.gradle" file. This file is at the same level of the "settings.gradle" in the directory structure, not inside the module.

  5. Edit the "repositories" directive inside the "allprojects". This is required to let the system find libraries needed by ABaker. Modify to look like the following in this exact order:

    allprojects {
        repositories {
            maven { url "http://dl.bintray.com/populov/maven" }
            mavenCentral()
            jcenter()
            maven {
                url 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
            }
        }
    }
    
  6. On the project view, extend your module node and open the "build.gradle" file. Notice is not the project but the node build file.

  7. Add the Android Baker Library to the compile dependencies

    compile 'com.baker:ABaker:1.1'
    
  8. Update the "minSdkVersion" to 11.

  9. Update the "targetSdkVersion" to 17.

  10. From the Android Baker Library "src/main" folder copy the "AndroidManifest.xml" file and replace the one on your project module.

  11. Replace the package name on the manifest definition with the package name of your project.

  12. From the Android Baker Library Project copy the assets and res folder to the same location in you own Project main module.

  13. Allow it to Overwrite all.

  14. On "res/values/strings.xml" you will find the URLs and properties you can override to make your project use your own servers.

  15. On "res/drawable-*/" you will find the images to replace for the application Icon. Make sure you use the same sizes when replacing them.

  16. On "res/layout/magazine_thumb_options.xml" you will find the values for colours, fonts and sizes of the main shelf view (list of issues).

  17. On "assets" you will find the html files that renders the Background of the Main shelf view, the Header and the Loading Screen. Make sure you create responsive html pages for you app so it renders correctly in all devices.