Android Studio development environment setup

Demo for reference(can not run without parameter):https://github.com/ULUGames/ulu-android-demo

The following code examples use gradle versions below 7.0 (excluding 7.0). Please adjust them according to your own gradle version.

For all brackets that have no parameters to fill in due to not using the corresponding function, please do not delete the fields, just keep the unchanged bracket content

1.1 Import ULUSDK library and config moudle's build.gradle

1.1.1 Config moudle's build.gradle

Please add apply plugins and set minSdkVersion to no less than 22 and targetSdkVersion to no less than 35

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
    ***
    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 35
        ***
    }
}

1.1.2 Import ULUSDK library in moudle's build.gradle


configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'//To ensure you get the latest library. This can be removed when build takes too long
}


dependencies {
    implementation 'com.ulusdk:ulusdk:【Please replace the brackets and the text in brackets with the latest ULUSDK version】-SNAPSHOT'
}

1.2 Config project's build.gradle

buildscript {
    dependencies {
        //If kotlin plugin is used, version should be 2.1.0 or above
        classpath 'com.android.tools.build:gradle:7.4.2' //should be 7.3.1 or above
        classpath 'com.google.gms:google-services:4.4.3' //should be 4.2.0 or above
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://repo.ulugame.com/repository/maven-public'}
        maven { url 'https://repo.onestore.co.kr/repository/onestore-sdk-public' }
        maven { url 'https://devrepo.kakao.com/nexus/content/groups/public/' }
    }
}

1.3 Config AndroidManifest.xml

<application

    android:usesCleartextTraffic="true">

    <!--channel_id Google:2, Onestore:3,Samsung:4, third party:14-->
    <meta-data
        android:name="channel_id"
        android:value="2" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
    <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
    <provider android:authorities="【Please replace the brackets and the text in brackets with any prefix(such as cbt.google.) to ensure that the authorities of each package are different】com.facebook.app.FacebookContentProvider【Please replace the brackets and the text in brackets with the Facebook app id in the parameter table】"
        android:name="com.facebook.FacebookContentProvider"
        android:exported="true"/>
    <meta-data
        android:name="com.kakao.sdk.AppKey"
        android:value="【Please replace the brackets and the text in brackets with the Kakao app key in the parameter table】"/>

    <activity android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
            android:exported="true">

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <!-- Redirect URI: "kakao${YOUR_NATIVE_APP_KEY}://oauth" -->
                <data android:scheme="kakao【Please replace the brackets and the text in brackets with the Kakao app key in the parameter table】" android:host="oauth" />

            </intent-filter>
        </activity>    


    <!--Notification related configuration (optional)-->
    <!--If notification's small icon should be changed, add following code and replace the resource-->
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@mipmap/a_notification_small_icon"/>
    <!--If notification's background color should be changed, add following code and replace the resource-->
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@android:color/a_notification_background_color"/>
</application>

1.4 Config res/values/strings.xml

<!--  ulusdk environment  sandbox:1  production:0 -->
<string name="ulu_env">1</string>
<!--samsung operation mode sandbox:1 production:0-->
<string name="samsung_operation_mode">0</string>
<string name="facebook_app_id">【Please replace the brackets and the text in brackets with the Facebook app id in the parameter table】</string>
<string name="facebook_client_token">【Please replace the brackets and the text in brackets with the Facebook client token in the parameter table】</string>
<string name="af_dev_key">【Please replace the brackets and the text in brackets with the Appsflyer dev key in the parameter table】</string>
<!--if there is no Google client_id in the parameter table,you can find it in google-services.json which the client_id's client_type is 3-->
<string name="google_login_web_client_id">【Please replace the brackets and the text in brackets with the Google client id in the parameter table】</string>
<string name="google_pay_key">【Please replace the brackets and the text in brackets with the Google pay key in the parameter table】</string>
<string name="onestore_pay_key">【Please replace the brackets and the text in brackets with the Onestore pay key in the parameter table】</string>
<string name="com.twitter.sdk.android.CONSUMER_KEY">【Please replace the brackets and the text in brackets with the Twitter consumer key in the parameter table】</string>
<string name="com.twitter.sdk.android.CONSUMER_SECRET">【Please replace the brackets and the text in brackets with the Twitter consumer secret in the parameter table】</string>
<string name="kakao_app_key" translatable="false">【Please replace the brackets and the text in brackets with the Kakao app key in the parameter table】</string>
<string name="naver_login_client_id" translatable="false">【Please replace the brackets and the text in brackets with the Naver client id in the parameter table】</string>
<string name="naver_login_client_secret" translatable="false">【Please replace the brackets and the text in brackets with the Naver client secret in the parameter table】</string>
<!--share config,set 1 to show-->
<string name="ulu_share_fb_on">0</string>
<string name="ulu_share_twitter_on">0</string>
<string name="ulu_share_ins_on">0</string>
<string name="ulu_is_pay_letter_toss_unable" translatable="false">1</string>

<!--Set to 1 if should apply for Google Play featuring(optional)-->
<string name="ulu_is_google_recommend">0</string>

1.5 Config proguard-rules.pro

    -keep class com.aliyun.**{*;}
    -keep class com.kakao.sdk.**.model.* { <fields>; }
    -keep class com.kakao.sdk.auth.AuthCodeHandlerActivity { *; }
    -keep class * extends com.google.gson.TypeAdapter

    -keep class com.navercorp.nng.android.sdk.api.service** { *; }
    -keep class com.navercorp.nng.android.sdk.api.entity.** { *; }

    -keep class com.navercorp.nng.android.sdk.NNGLink** { *; }
    -keep class com.navercorp.nng.android.sdk.NNGLink$Companion { *; }
    -keepclassmembers class com.navercorp.nng.android.sdk.NNGLink {
        public static ** Companion;
    }
    -keep class com.navercorp.nng.android.sdk.NNGConfig** { *; }

    -dontwarn org.bouncycastle.jsse.**
    -dontwarn org.conscrypt.*
    -dontwarn org.openjsse.**

    -keep class com.gaa.sdk.base.** { *; }
    -keep class com.gaa.sdk.auth.** { *; }

    -keep class com.gaa.sdk.iap.** { *; }

    -keep class com.onestore.extern.licensing.** { *; }

1.6 Add google-services.json to application folder

Just copy the file

results matching ""

    No results matching ""