Giter Club home page Giter Club logo

appgalleryconnect / agc-flutter-plugin Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 3.0 1.23 MB

This repository including all of exsiting plugins of AppGallery Connect Service in Flutter.

License: Apache License 2.0

Java 25.17% Ruby 2.03% Objective-C 2.82% Dart 47.01% Swift 22.97% Kotlin 0.01%
appgallery dart crash remoteconfig authentication authservice cross-platform flutter-plugin in-app-messaging cloudfunctions huawei-appgallery android-ios-hybrid

agc-flutter-plugin's Introduction

AGC-Flutter-Plugin

license

This repository contains the source code for AGC Flutter Plugins which are developed by the AppGallery Connect Team.

These libraries contains demo applications to enable access to using specific APIs. For more information about the services, and how to use them, check the corresponding Usage Guides for each service. Official Documentations.

Introduction

These are the available AGC Flutter Plugins in this repository.

Service Version Documentation (ZH) Documentation (EN)
cloudfunction version Getting Started
API Reference
Getting Started
API Reference
crash version Getting Started
API Reference
Getting Started
API Reference
remoteconfig version Getting Started
API Reference
Getting Started
API Reference
core version Getting Started Getting Started
applinking version Getting Started
API Reference
Getting Started
API Reference
appmessaging version Getting Started
API Reference
Getting Started
API Reference
authservice version Getting Started
API Reference
Getting Started
API Reference
clouddb version Getting Started
API Reference
Getting Started
API Reference

Precautions

The agc-flutter-plugin project contains 9 independent projects. After downloading the code, you can load different nested projects to the IDE as required. And you can run each project independently.

Question or issues

If you have questions about how to use AppGallery Connect Demos, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with appgallery or appgallery connect.
  • Huawei Developer Forum AppGallery Module is great for general questions, or seeking recommendations and opinions.
  • Submit ticket online If you encounter a serious or urgent problem, submit a trouble ticket online to contact Huawei technical support.

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

agc-flutter-plugin's People

Contributors

atavci avatar huan721 avatar mayism avatar rozeridilar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

agc-flutter-plugin's Issues

版本更新

请问什么时候能适配最新版本?好久没更新了啊

Error Opening app links

StreamSubscription<ResolvedLinkData> _streamSubscription;
 final AGCAppLinking s= new AGCAppLinking();
initState() {
    super.initState();

    _streamSubscription = agcAppLinking.onResolvedData.listen((event) {
      _showDialog(context, event.toString());
    });
  }

with the ff. exception

E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): Failed to close existing event stream
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): java.lang.IllegalArgumentException: Receiver not registered: null
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1523)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1712)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:733)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at com.huawei.agc.flutter.applinking.handlers.AppLinkingStreamHandler.onCancel(AppLinkingStreamHandler.java:45)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onListen(EventChannel.java:182)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at io.flutter.plugin.common.EventChannel$IncomingStreamRequestHandler.onMessage(EventChannel.java:167)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.os.Looper.loop(Looper.java:206)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at android.app.ActivityThread.main(ActivityThread.java:8550)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at java.lang.reflect.Method.invoke(Native Method)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/EventChannel#com.huawei.agc.flutter.applinking_eventchannel(13585): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
I/ViewRootImpl@8b8ac36[MainActivity](13585): [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4681 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938
I/ViewRootImpl@8b8ac36[MainActivity](13585): [DP] rdf()
E/com.huawei.agc.flutter.applinking.handlers.AppLinkingStreamHandler(13585):  code: 1 message: no intent data

Exception when using the buildShortAppLinking

_AGCAppLinking.buildLongAppLinking works fine.

AGCAppLinking.buildShortAppLinking builder throws the ff. error
E/AGCAppLinkingException(27918): (PluginException) UNKNOWN: url is null

error: package com.huawei.agconnectclouddb.objecttypes does not exist

Hi!

I encountered the following error for agconnect_clouddb: ^1.9.0+300 on Flutter 3.16.9 despite following the documentation. Please enlighten. Thanks!

  1. I have already unzipped the exported files (ObjectTypeInfoHelper.java & cloudDbZoneTest.java) to the required folder.

  2. This is my app level build.gradle.

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.huawei.agconnect"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}`

`android {
    namespace "com.example.app"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.app"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {}
  1. This is android folder level build.gradle.
buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
        maven {url 'https://developer.huawei.com/repo/'} 
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:8.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.huawei.agconnect:agcp:1.9.0.300'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {url 'https://developer.huawei.com/repo/'} 
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}
  1. Error Message
/Users/myName/.pub-cache/hosted/pub.dev/agconnect_clouddb-1.9.0+300/android/src/main/java/com/huawei/agconnectclouddb/utils/AGCCloudDBUtil.java:8: error: package com.huawei.agconnectclouddb.objecttypes does not exist
import com.huawei.agconnectclouddb.objecttypes.ObjectTypeInfoHelper;
                                              ^
/Users/myName/.pub-cache/hosted/pub.dev/agconnect_clouddb-1.9.0+300/android/src/main/java/com/huawei/agconnectclouddb/modules/AGCCloudDBModule.java:29: error: package com.huawei.agconnectclouddb.objecttypes does not exist
import com.huawei.agconnectclouddb.objecttypes.ObjectTypeInfoHelper;
                                              ^
/Users/myName/.pub-cache/hosted/pub.dev/agconnect_clouddb-1.9.0+300/android/src/main/java/com/huawei/agconnectclouddb/utils/AGCCloudDBUtil.java:14: error: cannot find symbol
        for (Class<? extends CloudDBZoneObject> clazz : ObjectTypeInfoHelper.getObjectTypeInfo().getObjectTypes()) {
                                                        ^
  symbol:   variable ObjectTypeInfoHelper
  location: class AGCCloudDBUtil
  /Users/myName/.pub-cache/hosted/pub.dev/agconnect_clouddb-1.9.0+300/android/src/main/java/com/huawei/agconnectclouddb/modules/AGCCloudDBModule.java:77: error: cannot find symbol
            AGConnectCloudDB.getInstance().createObjectType(ObjectTypeInfoHelper.getObjectTypeInfo());
                                                            ^
  symbol:   variable ObjectTypeInfoHelper
  location: class AGCCloudDBModule

something wrong with configuration while upload the release apk to appgallery store

Description
i follow all the docs from huawei dev. website and from the flutter repo readme , but still i got a rejection for update hms services
i only used this plugin : huawei_Iap, Huawei_account, Huawei_location
with the following pic that's the reject message :
Screen Shot 2021-02-13 at 3 31 45 PM

Current behavior
that's all my configration files :

build.gradle

buildscript {
    repositories {
        ..
        maven { url 'https://developer.huawei.com/repo/' }
        ..
    }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.2'
          ...
        classpath 'com.huawei.agconnect:agcp:1.4.2.301'
    }
    allprojects {
    repositories {
        ..
        maven { url 'https://developer.huawei.com/repo/' }
        ..
    }
    }

android build.gradle

...
apply plugin: 'com.huawei.agconnect'
...
    defaultConfig {
            resConfigs "ar", "en"
}
...
dependencies {
    implementation 'com.huawei.agconnect:agconnect-core:1.4.2.301'
    implementation 'com.huawei.hms:base:5.0.5.300'
    implementation 'com.huawei.hms:hwid:5.1.1.300'      
    implementation 'com.huawei.hms:iap:5.1.0.300'  
    implementation 'com.huawei.hms:appservice:5.0.4.302'  
    implementation 'com.huawei.hms:hianalytics:5.1.0.301'  
    implementation 'com.huawei.hms:location:5.1.0.300'  
}

proguard-rules.pro

-ignorewarnings 
-keepattributes *Annotation* 
-keepattributes Exceptions 
-keepattributes InnerClasses 
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable 
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.android.sdk.drm.**{*;}
-keep class com.huawei.agconnect.**{*;}
-keep class com.hianalytics.**{*;} 
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.hms.**{*;} 
-keep interface com.huawei.hms.analytics.type.HAEventType{*;}
-keep interface com.huawei.hms.analytics.type.HAParamType{*;}
-keep class com.huawei.hms.analytics.HiAnalyticsInstance{*;}
-keep class com.huawei.hms.analytics.HiAnalytics{*;}
-keepattributes EnclosingMethod

#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.**  { *; }
-keep class io.flutter.util.**  { *; }
-keep class io.flutter.view.**  { *; }
-keep class io.flutter.**  { *; }
-keep class io.flutter.plugins.**  { *; }
-dontwarn io.flutter.embedding.**
-keep class com.huawei.hms.flutter.** { *; }
-repackageclasses
  • I added the agconnect-services.json and all build.gradle thats connect agconnect-services.json to the app

i follow all this references

and till now i got the same reject , So i would be appreciate that , if anyone can help to avoid this kind of rejection

  • new Update
    i passed the automated review by removing my app from China in appGallery
    also after the update it gives me this behavior , is that normal

also if we can involve our app with a flutter plugin that solve the CheckUpdate by huawei it will be very kindly

Flutter Build Fails with HMS Integration: com.huawei.agconnectclouddb.objecttypes Package Not Found

I am working on integrating Huawei Mobile Services (HMS) into my existing Flutter application by following the official documentation.

Here is what I have done so far:

  1. I have created a project in AppGallery Connect and set up an Android app.

  2. Downloaded the agconnect-services.json configuration file and placed it in the android/app directory.
    image

3.Added the necessary Gradle configurations to the project-level build.gradle and the app-level build.gradle.

android level build.gradle:
`allprojects {
repositories {
google()
jcenter()
// Add the following line:
maven {url 'https://developer.huawei.com/repo/'}
}
}

buildscript {
repositories {
google()
jcenter()
// Add the following line:
maven {url 'https://developer.huawei.com/repo/'}
}
}
//buildscript > dependencies
buildscript {
dependencies {
// Add the following line:
classpath 'com.huawei.agconnect:agcp:1.9.0.300'
}
}`

app-level build.gradle:
apply plugin: 'com.huawei.agconnect'

  1. Included the HMS dependencies agconnect_crash and agconnect_clouddb in my pubspec.yaml:

image

  1. Ran 'flutter pub get' to fetch packages.

But when I try to run the application, the build fails with the following errors:
`PS C:\Users\User\hulatech_teacher_app> flutter run
Launching lib\main.dart on JNY LX1 in debug mode...
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\modules\AGCCloudDBModule.java:29: error: package com.huawei.agconnectclouddb.objecttypes does not exist
import com.huawei.agconnectclouddb.objecttypes.ObjectTypeInfoHelper;
^
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\utils\AGCCloudDBUtil.java:8: error: package com.huawei.agconnectclouddb.objecttypes does not exist
import com.huawei.agconnectclouddb.objecttypes.ObjectTypeInfoHelper;
^
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\modules\AGCCloudDBModule.java:77: error: cannot find symbol
AGConnectCloudDB.getInstance().createObjectType(ObjectTypeInfoHelper.getObjectTypeInfo());
^
symbol: variable ObjectTypeInfoHelper
location: class AGCCloudDBModule
C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dev\agconnect_clouddb-1.9.0+300\android\src\main\java\com\huawei\agconnectclouddb\utils\AGCCloudDBUtil.java:14: error: cannot find symbol
for (Class<? extends CloudDBZoneObject> clazz : ObjectTypeInfoHelper.getObjectTypeInfo().getObjectTypes()) {
^
symbol: variable ObjectTypeInfoHelper
location: class AGCCloudDBUtil
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':agconnect_clouddb:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 49s
Running Gradle task 'assembleDebug'... 50,8s
Exception: Gradle task assembleDebug failed with exit code 1`

HMS dependencies versions provided by the official documentation were out of date, so I checked the pub.dev and updated the versions. I was expecting the app to build successfully and run in debug mode on my emulator/device.

What could be causing these errors, and how can I resolve them?

提个建议

目前使用applink发现应用在后台期间,通过链接打开app无法获取参数
应该再安卓onresume的时候再次去eventSink发下新数据吧,而且flutter的MainActivity应该是singleTop

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.