0

First of all, sorry if this is duplicate, couldn't find correct solution. We have issue with publishing apk to huawei app gallery. Currently app is visible on Huawei AppGalley for devices which have support for Google play (older than may 2019). We have issue, same app is not visible on newer devices, which doesn't have google play. What could be solution for it? Tried adding huawei repo to all project maven and we added agconnect-services.json with required deps but it didn't work. Any advice, potential solution about this?

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
        maven { url 'http://developer.huawei.com/repo/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.0.1'
        //android performanse
        classpath 'com.google.firebase:firebase-plugins:1.1.5'
        classpath 'com.huawei.agconnect:agcp:1.2.0.300'


    }
}

allprojects {
    repositories {
        google()

        jcenter()

        maven {
            url "https://jitpack.io"

        }
maven { "https://maven.google.com"}
maven { url 'http://developer.huawei.com/repo/' }
  }
}

// build.gradle (app)

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.huawei.agconnect'


buildscript {

    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.+'
    }

    ext.retrofit_version = "2.3.0"
    ext.ok_http_version = "3.9.1"
    ext.butterknife_version = "8.8.1"
    ext.dagger_version = "2.10"
    ext.timber_version = "4.5.1"
    ext.rx_java_version = "1.2.0"
    ext.rx_android_version = "1.2.1"
    ext.rx_binding_version = "3.0.0"
    ext.page_indicator_version = "0.2.0"
    ext.gson_version = "2.8.2"
    ext.glide_version = '3.7.0'
    ext.android_support_version = "28.0.0"
    ext.gsm_ads_version = "15.0.1"
    ext.firebase_perf_version = "16.0.0"
    ext.firebase_core_version = "16.0.1"
    ext.firebase_messenging_version = "17.0.0"
    ext.gsm_measurement_version = "16.0.0"
    ext.leak_cannary_version = "1.5.4"
    ext.auto_value_gson_version = "0.6.0"
    ext.auto_value_parcel_version = "0.2.5"
    ext.rx_java_proguard_version = "1.2.3.0"
    ext.javax_annotations_version = "1.0"
    ext.junit_version = "4.12"
    ext.espresso_version = "2.2.2"
    ext.hamcrest_version = "1.3"
    ext.roboelectric_version = "3.3.2"
    ext.mockito_version = "2.6.4"
    ext.job_dispatcher_version = "0.8.5"
    ext.crashanalitycs_version = "2.9.3"
    ext.autoservice_version = "1.0-rc3"
    ext.constaint_layout_version = "1.1.2"
    ext.chip_layout_manager = "0.3.7"
    ext.multidex_version = "1.0.3"
    ext.huawei_hwid_version = "4.0.0.300"
    ext.didomi_version = "1.10.9"
}


android {
    compileSdkVersion 29
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "app package"
        minSdkVersion 22
        targetSdkVersion 29
        versionCode 29
        versionName "1.2.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }

    defaultConfig {
        ...
        ndk {
            abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
        }

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {

        debug {

            ...
        }
        release {
            ...
        }
    }
    flavorDimensions "ads"

    productFlavors { ...}
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }

}

allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation project(":DotmetricsSDK.Android")
    implementation "com.android.support:multidex:$multidex_version"
    implementation "com.romandanylyk:pageindicatorview:$page_indicator_version"
    implementation "com.google.dagger:dagger:$dagger_version"
    implementation "com.jakewharton:butterknife:$butterknife_version"
    implementation "com.android.support.constraint:constraint-layout:$constaint_layout_version"
    annotationProcessor "com.jakewharton:butterknife-compiler:$butterknife_version"
    annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
    implementation "com.jakewharton.timber:timber:$timber_version"
    implementation "io.reactivex:rxandroid:$rx_android_version"
    implementation "com.jakewharton.rxbinding3:rxbinding:$rx_binding_version"
    implementation "io.reactivex:rxjava:$rx_java_version"
    implementation "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
    implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
    implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
    implementation "com.squareup.okhttp3:okhttp-urlconnection:$ok_http_version"
    implementation "com.squareup.okhttp3:logging-interceptor:$ok_http_version"
    implementation("com.squareup.retrofit2:converter-simplexml:$retrofit_version") {
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'
    }
    implementation "com.google.code.gson:gson:$gson_version"
    implementation "com.android.support:appcompat-v7:$android_support_version"
    implementation "com.android.support:design:$android_support_version"
    implementation "com.google.firebase:firebase-core:$firebase_core_version"
    implementation "com.google.firebase:firebase-messaging:$firebase_messenging_version"
    implementation "com.google.firebase:firebase-perf:$firebase_perf_version"
    implementation "com.google.android.gms:play-services-ads:$gsm_ads_version"
    testCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_cannary_version"
    debugCompile "com.squareup.leakcanary:leakcanary-android:$leak_cannary_version"
    releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leak_cannary_version"
    testCompile 'junit:junit:4.12'
    annotationProcessor "com.google.auto.service:auto-service:$autoservice_version"
    provided("com.ryanharter.auto.value:auto-value-gson:$auto_value_gson_version") {
        exclude group: 'com.google.auto.service', module: 'auto-service'
    }
    annotationProcessor("com.ryanharter.auto.value:auto-value-gson:$auto_value_gson_version") {
        exclude group: 'com.google.auto.service', module: 'auto-service'
    }
    annotationProcessor("com.ryanharter.auto.value:auto-value-parcel:$auto_value_parcel_version") {
        exclude group: 'com.google.auto.service', module: 'auto-service'
    }
    //Glide
    implementation "com.github.bumptech.glide:glide:$glide_version"
    //GEMIUS
    implementation(name: 'GemiusSDK_1.3.3', ext: 'aar')
    provided "javax.annotation:jsr250-api:$javax_annotations_version"
    //ProGuard rules for RxJava!
    implementation "com.artemzin.rxjava:proguard-rules:$rx_java_proguard_version"

    implementation "com.firebase:firebase-jobdispatcher:$job_dispatcher_version"

    implementation("com.crashlytics.sdk.android:crashlytics:$crashanalitycs_version@aar") {
        transitive = true
    }
    implementation "com.beloo.widget:ChipsLayoutManager:$chip_layout_manager"

    implementation "com.huawei.hms:hwid:$huawei_hwid_version"

    implementation "io.didomi.sdk:android:$didomi_version"

    testImplementation "junit:junit:$junit_version"
    // Set this dependency if you want to use Hamcrest matching
    testImplementation "org.hamcrest:hamcrest-library:$hamcrest_version"
    testImplementation "org.robolectric:robolectric:$roboelectric_version"
    testImplementation "org.mockito:mockito-core:$mockito_version"
    androidTestImplementation("com.android.support.test.espresso:espresso-core:$espresso_version", {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude(group: 'com.google.code.findbugs', module: 'jsr305')
    })
    androidTestImplementation("com.android.support.test.espresso:espresso-contrib:$espresso_version") {
        // Necessary to avoid version conflicts
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude(group: 'com.google.code.findbugs', module: 'jsr305')
        exclude module: 'recyclerview-v7'
    }
}
apply plugin: 'com.google.gms.google-services'

//AndroidManifest

<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="hr.index.indexme">
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WAKE_LOCK" />
   <!-- This is needed because of dotmetrics -->
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
   <application android:name=".App" android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:networkSecurityConfig="@xml/network_config" android:usesCleartextTraffic="true" android:theme="@style/AppTheme">
      <uses-library android:name="org.apache.http.legacy" android:required="false" />
      <activity android:name=".splash.activity.view.SplashActivity" android:screenOrientation="portrait" android:theme="@style/SplashTheme">
         <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
         </intent-filter>
      </activity>
      <activity android:name=".main.activity.view.MainActivity" android:launchMode="singleTask" android:screenOrientation="portrait" />
      <activity android:name=".article.activity.gallery.view.ArticleActivity" android:screenOrientation="portrait" android:launchMode="singleTop" android:taskAffinity="index.article" />
      <activity android:name=".walkthrough.activity.view.WalkthroughActivity" android:screenOrientation="portrait" />
      <activity android:name=".search.view.SearchActivity" android:screenOrientation="portrait" android:windowSoftInputMode="stateAlwaysVisible|adjustPan" />
      <activity android:name=".settings.activity.view.SettingsActivity" android:screenOrientation="portrait" />
      <activity android:name=".tag.list.view.TagListActivity" android:screenOrientation="portrait" />
      <activity android:name=".terms.view.TermsActivity" android:screenOrientation="portrait" />
      <activity android:name=".contact.view.ContactActivity" android:windowSoftInputMode="adjustPan" android:screenOrientation="portrait" />
      <activity android:name=".weather.view.WeatherActivity" android:screenOrientation="portrait" />
      <activity android:name=".sendNews.activity.view.SendNewsActivity" android:screenOrientation="portrait" />
      <activity android:name=".comments.activity.view.CommentsActivity" android:screenOrientation="portrait" android:windowSoftInputMode="adjustResize" />
      <activity android:name=".article.activity.single.view.SingleArticleActivity" android:screenOrientation="portrait" />
      <service android:name=".base.service.UploadService" />
      <service android:name=".fcm.IndexFirebaseInstanceIDService">
         <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
         </intent-filter>
      </service>
      <service android:name=".fcm.IndexFirebaseMessagingService">
         <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
         </intent-filter>
      </service>
      <service android:name=".breaking_news.service.BreakingNewsJobService" android:exported="false">
         <intent-filter>
            <action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
         </intent-filter>
      </service>
      <meta-data android:name="io.fabric.ApiKey" android:value="api key" />
      <activity android:name=".tag.settings.view.TagSettingsActivity" />
      <activity android:name=".tag.search.view.TagSearchActivity" android:label="@string/title_activity_tag_search" android:theme="@style/AppTheme" />
      <activity android:name="dotmetrics.analytics.UrlCatchActivity">
         
    
         <intent-filter tools:ignore="AppLinkUrlError">
            
    
            <action android:name="android.intent.action.VIEW" />
            
    
    
            <category android:name="android.intent.category.DEFAULT" />
            
    
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:host="hr.index.indexme" android:scheme="dotmetrics" />
            
    
         </intent-filter>
      </activity>
   </application>
</manifest>
bagy94
  • 48
  • 8
  • post your `AndroidManifest.xml` and app `build.gradle` here so we can see. – Pierre Mar 12 '20 at 09:05
  • @Pierre there it is – bagy94 Mar 17 '20 at 13:05
  • So far, I don't see your implementation of `Agconnect-core` which is mandatory. – Pierre Mar 18 '20 at 05:28
  • I also think `android:usesCleartextTraffic="true"` is an issue for the newer devices which probably enforce security ie. `HTTPS` traffic. – Pierre Mar 18 '20 at 05:35
  • Have you set your "Fingerprint" in the Huawei Developer Console? (You get the key from your keystore and add it to the console) https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/appgallerykit-preparation – Pierre Mar 18 '20 at 05:42
  • Also add `apply plugin: 'com.huawei.agconnect'` again in your `build.gradle (app)` under `apply plugin: 'com.google.gms.google-services'` (Keep both at the top and at the bottom) – Pierre Mar 18 '20 at 05:48
  • Tnx for suggestions, but none of it helped. Fingerprint is set and we tried with adding both to top and bottom, but result is same. Our guess is that gms (admob and maybe firebase push notifs) are causing problem, because it works on all other device manufactures (with newest android os) and on huawei devices which have installed google play. – bagy94 Mar 19 '20 at 10:28
  • So it simply just doesn't appear in the Huawei App Gallery for those newer devices? – Pierre Mar 19 '20 at 13:31
  • yes, that's main issue here – bagy94 Mar 20 '20 at 13:03
  • Try and contact Huawei developer support directly and see if they can give you answers – Pierre Mar 20 '20 at 14:10
  • @bagy94 please check out my answer https://stackoverflow.com/questions/59974428/have-both-gms-and-hms-in-the-project/60587678#60587678 Also, please tell me the name of the app or give me your app id. – deadfish Mar 26 '20 at 19:59
  • @deadfish thanks for suggestion. We will try that and I'll let you know if it works. App name is Index.me – bagy94 Mar 27 '20 at 13:37
  • @bagy94 your app crashes with phones without GMS - this is additional reason. If you don't have Huawei to test it, visit your Huawei Developer Account and select from the main page the bottom service called "Cloud Debugging". You will be able select very fast Huawei devices to test your app live in the cloud. – deadfish Mar 27 '20 at 14:33
  • @deadfish we just got new huawei device and now we can debug it. It crashes because there is no GMS support as all of you mentioned. Plan is to add huawei service instead of google (for devices which doesn't have google play). I hope that's going to solve our problem. Tnx to all of you for help, i ll let you know if it works when it's done. – bagy94 Mar 30 '20 at 06:43
  • @bagy94 sure, I am here anytime. Good luck and don't forget to close the question. – deadfish Mar 30 '20 at 22:22

2 Answers2

0

Your app is visible only for devices having GMS because you are using some Google's libraries which don't work on Huawei's devices having only HMS.

Only older Huawei's phones had GMS.

To fix it You will have to:

  1. Implement Huawei's kits (alternatives to Google's libs you have).
  2. Make if-else conditions in places of your code where you call Google functions and support functions for Huawei.
  3. Test the app and submit to AppGallery.

It works like that:

  1. Is app working fine on phones having only HMS?
    • Yes? Mark it visible for phones with same HMS.
    • No? Mark it not visible for phones with same HMS.
  2. Is app working fine on phones having GMS?
    • Yes? Mark it visible for phones with GMS.
    • No? Reject the app because it doesn't work at all.

Please, check out this answer: Have both GMS and HMS in the project

deadfish
  • 11,996
  • 12
  • 87
  • 136
0

That should be a review policy when you publish your app to Huawei's AppGallery.
If your app has some dependencies rely on Google Play Services then it will not work on Huawei devices those dont have Google Play Services; it will either crash or show dialogs of Google Play services required.

In order to solve this, it is necessary to;
1- Implement the same services from HMS Core (for example FCM to Huawei Push) and AppGallery Connect (Crashlytics to Huawei Crash)
2- Build either a new and separate APK just with HMS dependencies or a implement a wrapper in your APK where it either uses Google's libraries or HMS based on the service availability on the device

Alternatively, you can choose services those dont depend on Google Play Services

captaink
  • 476
  • 3
  • 8