How To Use Buildbox With Android Studio In Few Steps

Discussion in 'Technical Discussion' started by vallic, Jan 16, 2017.

  1. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    Hi,

    After starting to use Buildbox have problem with Eclipse and also Android Studio is much more user friendly. I have stumbled on some problems, and have found some tutorials how to start, but have still some errors (mostly related to KitKat)

    So most of the work is based on this tutorial with few additional changes.
    Below are steps with files attached and video screencast (sorry, no sound for now). Also last 7-8 minutes are just waiting for emulator to start (really slow on Mac).

    1. Export BuildBox game

    2. Start Android Studio

    3. Click Import project (Eclipse ADT, Gradle, etc.)
    4. Copy gradle.properties and build.gradle file inside app folder
      download files -> https://drive.google.com/drive/folders/0BxAXRGhnvQzpZ0ZRd29xZVhUazA?usp=sharing

    5. Edit line 8 inside copied build.gradle file - change application id to your application id.
      (we can use existing build.gradle which is generated on import, but you will need add then manual multiple changes - see end of video)
    6. While we have multiDexEnabled true inside build.gradle file, we need to make small change in AndroidManifest.xml file to make app works for API 20 and below.

      Go to inside app folder to src/main/AndroidManifest.xmland inside application tag add following line:

      android:name="android.support.multidex.MultiDexApplication"

      Without this line, you can create android app, even publish it, but it will crash on any device with API 20 or lower. - android 4.4W KitKat or older.
    7. Sync / Build / Run on emulator
    8. Publish - export apk
     
  2. Zildsaw

    Zildsaw Boxer

    Joined:
    Jan 26, 2017
    Messages:
    4
    Likes Received:
    1
    Hi men , finally I can enter the forums. I got a few issues with BB and Android Studio, the real problem is that my game only run in APIs superior to 21. My game it´s planned to run in almost all devices. I really need that this game run in APIs lower than 21 and this method don´t work.
    Got any advice?? Really a did exactly the same code, but does not work in DVM only on ART.
     
    vallic likes this.
  3. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    first, you build.gradle is exactly the same (and applicationID correct) as below?

    Second, have you copied gradle.properties.

    And finally, inside app/src/main/AndroidManifest.xml you added this line:
    android:name="android.support.multidex.MultiDexApplication"

    (like on screenshot) line.jpg

    Without this third step, app will for sure not working on KitKat or older even you made first two things. This line is specific used for devices below API21 to add multidex support

    Code:
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.2"
    
        defaultConfig {
            applicationId "com.example.your_app_id"
            minSdkVersion 11
            targetSdkVersion 25
            multiDexEnabled true
    
            ndk {
                moduleName "player_shared"
            }
        }
    
        buildTypes {
            release {
                minifyEnabled false
                shrinkResources false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
    
         
        }
        sourceSets.main {
            jni.srcDirs = []// <-- disable automatic ndk-build call
        }
    }
    
    dependencies {
        compile ('com.google.android.gms:play-services:+'){exclude module: 'support-v4'}
        compile files('libs/dagger-1.2.2.jar')
        compile files('libs/javax.inject-1.jar')
        compile files('libs/nineoldandroids-2.4.0.jar')
        compile files('libs/support-v4-19.0.1.jar')
        compile ('com.android.support:multidex:1.0.1')
    }
     
  4. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    can you upload bbdoc file here, or example of one which is not working?
     
  5. Jaky1

    Jaky1 Serious Boxer

    Joined:
    Aug 22, 2016
    Messages:
    523
    Likes Received:
    142
    @vallic @Zildsaw Switch to Eclipse bro, much easier - I also switched from AS to ECLIPSE.
     
    vallic likes this.
  6. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    eclipse is like dinosaur :) but to make Buildbox work with AS is quite easy after first time ;)
     
    Member_Game and Zildsaw like this.
  7. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    @Zildsaw or better if you can post log from AS when you run app in emulator
     
  8. Jaky1

    Jaky1 Serious Boxer

    Joined:
    Aug 22, 2016
    Messages:
    523
    Likes Received:
    142
    Your choice, but I find eclipse much easier and quicker.
     
  9. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    it's needed 5 minutes to create apk file ;) from which 4 minutes is waiting to generate apk. 1 minutes is needed for adjustments from above tutorial

    but as you stated, everyone have their choice. And have some other, non-buildbox projects there, so NO, Eclipse is neither easier, or quicker ;)
     
  10. nivram

    nivram Boxer

    Joined:
    Jan 27, 2017
    Messages:
    3
    Likes Received:
    1
    for me I cant get eclipse to work
     
  11. nivram

    nivram Boxer

    Joined:
    Jan 27, 2017
    Messages:
    3
    Likes Received:
    1
    DUDE OMG, For the past week I have been so frustrated I could get build apk to work. BUT THANKS TO YOU I did it NO PROBLEM! Thank you so much for this tutorial!
     
    vallic likes this.
  12. Zildsaw

    Zildsaw Boxer

    Joined:
    Jan 26, 2017
    Messages:
    4
    Likes Received:
    1
    actually i really love AS and I keep Eclipse out of BB. And this method really works and make AS truly compatible with BB ........................BUT, only in ART, in DVM (lower APIs) is getting errors. Ok ,I will double check my code , I reply soon .
     
  13. Zildsaw

    Zildsaw Boxer

    Joined:
    Jan 26, 2017
    Messages:
    4
    Likes Received:
    1
    Dude, i like to keep Eclipse for Java and BB for AS , since I download AS i love him owo
     
  14. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    OK, if you have done all by tutorial and is still crashing, just send me logs from AS when you start simulator
     
  15. Zildsaw

    Zildsaw Boxer

    Joined:
    Jan 26, 2017
    Messages:
    4
    Likes Received:
    1
    sorry men , my lap doesn´t have dat power. I run my test on my phone, I don´t know if I can get any log from there.
    I´m still getting that black screen in APIs lower than 21. But let me see if I can get any log from my cel and I come back to you.
     
  16. eyal

    eyal Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    642
    Likes Received:
    121
    and now it's not working again - this is what I keep on getting -
    Error:Error: The file name must end with .xml or .png
     
  17. eyal

    eyal Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    642
    Likes Received:
    121
    and when I try in eclipse this is what I get -
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #ff2600}

    google-play-services_lib] invalid resource directory name: /Users/user/Google Drive/new games/Blood/blood_02_07Android/android/libs/google-play-services_lib/res Icon
     
  18. vallic

    vallic Boxer

    Joined:
    Dec 26, 2016
    Messages:
    36
    Likes Received:
    21
    How you mean "now it's not working again"? So first time have worked? How you have update files second times?
     
  19. RollingStone

    RollingStone Boxer

    Joined:
    Sep 15, 2016
    Messages:
    10
    Likes Received:
    3
    Come on BB, give us AS support, it's 2017!!!
     
    vallic likes this.
  20. rechris2

    rechris2 Boxer

    Joined:
    Oct 8, 2015
    Messages:
    57
    Likes Received:
    7
    hi, i get this error:
    Error:Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : uses-sdk:minSdkVersion 11 cannot be smaller than version 14 declared in library [com.google.android.gms:play-services:10.2.0] /Users/bbb/StudioProjects/android4/app/build/intermediates/exploded-aar/com.google.android.gms/play-services/10.2.0/AndroidManifest.xml
    Suggestion: use tools:eek:verrideLibrary="com.google.android.gms.play_services" to force usage
     

Share This Page