NIFCLOUD-mbaas / UserCommunity

ニフクラ mobile backend ユーザーコミュニティ
https://mbaas.nifcloud.com/
81 stars 18 forks source link

【過去質問】SDKのアクティビティ設定について #1346

Open ncmbsupport opened 1 year ago

ncmbsupport commented 1 year ago

開発用でパッケージ名が異なるアプリをビルドした際に、アクティビティ設定がうまく行かない事象が起きています。 Android v4.0.3以下のSDKファイルは以下のコミュニティを参考にカスタマイズして対応できましたが、 https://github.com/NIFCLOUD-mbaas/UserCommunity/issues/411 https://github.com/NIFCLOUD-mbaas/UserCommunity/issues/561

v4.1.1へのバージョンアップの都合上、SDKファイルをカスタマイズせずにアクティビティ設定したいのですが、方法がありますか?

ncmbsupport commented 1 year ago

ご要望に添えず申し訳ございませんが、お客様の利用方法は提供しているドキュメント(※)の想定外の利用方法となるため、 サポート対象外となります。 恐縮ではございますが、何卒ご了承いただけますと幸いです。

※提供しているドキュメント|基本的な使い方 https://mbaas.nifcloud.com/doc/current/push/basic_usage_android.html

なお、Android v4.1.0以降のカスタマイズしたSDKをビルドする際の注意点を補足としてご案内させていただきます。

Android SDK v4.1.0より、mavenへの公開に従い、build gradleの設定変更が行われました。 また、build gradleに記載しているタスクを実行するには、ローカル環境への追加設定も必要になりました。 以上より発生するビルドエラーを回避するためには、SDKソースの直下にございますbuild.gradleについて、 以下のようにmaven関連の設定を取り除く事でローカル環境はそのままでビルドが成功すると考えられます。

SDKをカスタマイズされる際のご参考になれば幸いです。

apply plugin: 'com.android.library'

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
    }
}

version = '4.1.1'
group = 'com.nifcloud.mbaas'

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}
android {
    compileSdkVersion 29
    buildToolsVersion '29.0.2'

    defaultConfig {
        minSdkVersion 14
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        disable 'GradleDependency'
        lintConfig file("lint.xml")
    }
}

repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.google.firebase:firebase-messaging:22.0.0'
    implementation 'com.google.android.gms:play-services-base:17.6.0'
    implementation 'com.google.code.gson:gson:2.9.1'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation "androidx.annotation:annotation:1.0.0"

    testImplementation 'junit:junit:4.12'
    testImplementation "org.robolectric:robolectric:3.0"
    testImplementation 'org.robolectric:shadows-httpclient:3.0'
    testImplementation 'com.squareup.okhttp:mockwebserver:2.3.0'
    testImplementation 'org.mockito:mockito-core:1.10.19'
    testImplementation 'org.powermock:powermock-api-mockito:1.6.5'
    testImplementation 'org.powermock:powermock-module-junit4:1.6.5'
    testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.5'
    testImplementation 'org.powermock:powermock-classloading-xstream:1.6.5'
    testImplementation 'org.yaml:snakeyaml:1.15'
    testImplementation 'org.skyscreamer:jsonassert:1.2.3'
    testImplementation "org.robolectric:shadows-play-services:3.0"
    testImplementation "org.robolectric:shadows-support-v4:3.0"

}

task clearJar(type: Delete) {
    delete 'build/libs/' + JAR_NAME
}
task makeJar(type: Copy) {
    from('build/intermediates/intermediate-jars/release')
    into('release/')
    include('classes.jar')
    rename('classes.jar', JAR_NAME)
}
makeJar.dependsOn(clearJar, build)

今後ともよろしくお願いいたします。