What can I do if I cannot upload the native symbol file when using the Crash service? - Huawei Developers

I have been using the Crash service provided by HUAWEI AppGallery Connect recently. However, I encountered two problems when using it. One is that the native symbol file failed to be generated, and two, I failed to upload the file. In this post, I summarized my experience in the hope that it will help others who encounter the same problem.
Generating a Native Symbol File​I added the following code by referring to the official materials but couldn't find the agcp task in the Tasks directory under
Gradle.
Code:
agcp{
debug = true
appVersion = 1.0
symbolUpload = true
debugSoDirectory = "D:\\Onebox\\AndroidProject\\crashdemo\\app\\build\\intermediates\\cmake"
ndkDirectory = "D:\\AndroidSDK\\sdk\\ndk\\21.3.6528147"
}
I checked the documentation and found that I hadn't added the JSON file, so I added the JSON file to the app directory and synchronized the project. This resolved the problem.
A missing debugSoDirectory parameter will also cause the problem. So, make sure you add it as well.
Uploading a Native Symbol File​Once the file was generated, I double-clicked processReleaseSymbolUpload. An HTTP exception was reported, as shown in the following figure.
I often connect my PC to our company's proxy. Once I disconnected from the proxy, the file was uploaded successfully.
If you cannot upload the file using a gradle plugin, you can also use a symbol table tool.
Or, you can manually upload the file in AppGallery Connect.
For more info see the official documentation

Related

[Q] How do you add WebView with web kit engine to an existing application.

I am developing an android application and wanted to add a Web View with the Web kit engine inside the application. I get errors when I add a new package inside the app activity folder, i.e. (package remote.mobile.droidapp; existing package name.
(package lewisham.ac.uk) new package I added for web view....... It gives me an option to move the existing app package to the new package with the url link I'm trying to create for web view. The code I added is:
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
I also got an error with (R.id.webview), id within this area of the code. Its giving me an option to Create field 'id' in type 'R' or Create constant 'id' in type 'R'. I am truly grateful for any help, thanks.

[AppsUP] Frequently Asked Questions About Huawei Push Kit

More information about the contest, you can visit HUAWEI Developer Forum.​
The AppsUP contest has already been launched more than two weeks. Many friends of mine have taken part in it already. And they unexpectedly meet many difficulties in the process of developing the apps. I believe many developers are the same. Today I want to share the frequently asked questions of Push Kit with you.
Q: How to configure the Huawei platform to receive notifications on all devices that have my application installed?
A: Please select All in Push Scope to send to all devices.
Q: PushKit take long time to be received on testing mode ?
A: These are the main issues of slowness. If you encounter the same problem, you can try to trace the issue according to the following list:
Sending time:
Receiving time:
SN number of the phone (dial *#06#):
appId:
name of apk:
Q: Test the ringtone of the customized notification channel on the Android client. But the message still the default marketing channel is used instead of the customized notification channel. Therefore, the customized ringtone is not played.
A: When creating a customized channel, you need to set the sound. Check whether the sound is set during channel creation. The ringtone file must be stored in the /res/raw directory of the application. Ensure that the file is stored in the correct location as required. For details, see the sound field description of https://developer.huawei.com/consumer/en/doc/development/HMS-References/push-sendapi
Ensure that the sound field is the same as the sound file name in the code,
The default sound field must be set to false. Finally, with regard to the level of messages sent, if the message level is judged to be average, the sound will be the default system sound.
Q: Failed to obtain the token ID after Huawei Push is integrated.
A: The APIClient object may be invalid. Check the code for initializing the APIClient object,
1. Choose Settings > Apps > App Manager, search for Huawei Mobile Services, clear the cache, check the update, and try to obtain the token again. For non-Huawei phones, install the latest version of Huawei Mobile Services (APK).
2. If the EMUI version is 10 or later, getToken is returned. If the EMUI version is earlier than 10, onNewToken is returned.
Q: Upgrading the Xamarin version from 3.2 to 4 is it going to affect the Integration of Push Kit?
A: Version upgrade should not affect the integrations, but if the upgrade causes compatibility version issues, Microsoft recommends remove all packages and re-add Xamarin.
This can be a reference: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/troubleshooting/
And if the CP wants to upgrade, is better make a backup first
Q: I am trying to use push kit for sending notification to my app users. I want send notification using api method. But it shows "error_description": "missing required parameter: client_id".
A: Please check your client code. This error comes up when you have the client id missing.
Q: Why sometimes the app does not receive any new pushes
A: Firstly, collect the push logs:
1. Dial *#*#2846579#*#*
2. Background Setting-->Background Debug-->Open
3. Background Setting-->AP Log Setting-->Open
4. adb shell setprop log.tag.hwpush VERBOSE
5. adb logcat -v threadtime 1>d:\log.txt
6. Please try to reproduce the push problem
7. Ctrl+C to stop the step 5
Then, search "PushLog" from log.txt
1.If the result like "PushLog100101200", it means HMS push is the default system push channel
2.If the result like "PushLog40002310_HMS", it means HMS push is not the default system push channel. In this case, the push is not stable enough.
So, Check GMS available or not firstly, if GMS is available, then use GMS push, if not, if HMS is available, then use HMS push.
Note: For some Huawei Phone support both GMS and HMS, even if you unstall the GMS, HMS push will not automatically become the default system push channel.
Q: Huawei push SDK has been correctly integrated and can obtain the app ID from agconnect-servicesjson to obtain the token. 907135701:907135700 is displayed.
A: Check whether the debug and release versions of your app use different signature certificate
Q: The Message ”No manifest found” Is Displayed When the Push Demo Code Is Run.
A: This problem occurs when the agcp plug-in version is earlier than 1.2.1.301. You can solve this problem in the following ways.
Method 1: Upgrade the agcp plug-in to the latest version. Go to buildscript > dependencies and and change the agcp version.
Method 1: Add the following configuration to the end of the build.gradle file at the application level to disable the dependency of the agcp plug-in on the manifest file.
After the build.gradle file is modified, Sync Now is displayed in the upper right corner. Click Sync Now and wait until the synchronization is complete. Or details, see Integrating the HMS SDK in Preparations:
https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/Preparations#h1-1575707420071
Q: Compilation Errors in React Native Version 0.59.8
A: Following is a sample build.gradle file that can successfully resolve the problematic modules in the description:
Code:
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
maven {url 'http://developer.huawei.com/repo/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.huawei.agconnect:agcp:1.2.1.301'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
maven {url 'http://developer.huawei.com/repo/'}
}
}
I will supplement other frequently asked questions about this kit regularly.
If you also have other questions about this kit. Leave your comment below.

What should I do if the tool package fails to run when I integrate the HUAWEI AppGallery Connect SDK to Eclipse?

Background​I had recently planned on integrating the Crash SDK to my app. However, my app was developed through Eclipse and the integration process was different from that in Android Studio.
By referring to the official materials, I downloaded the tool package and used it to generate an Eclipse project package.
However, when the build.bat file in the aar2eclipse/aar directory was executed according to the procedures in the document, an error was reported in the command line. The error information was as follows:
FAILURE: Build failed with an exception.
* What went wrong:
Task ' assembleRelease ' not found in root project ' aar '.
Problem Reoccurring​1. I first thought that the problem might be caused by my company's intranet. But when I connected to the Internet, the problem remained unsolved.
2. Then I guessed that it might have something to do with the Android development environment.
I borrowed a colleague's PC to execute the build.bat file, and it that did the trick. Therefore, I was able to conclude that the problem was caused by incorrect configurations in the Android development environment. I compared the configurations on the two PCs and found that the environment variables were different. ANDROID_HOME was missing from the environment variables on my PC.
Cause​Huawei's Eclipse tool package is unable to run properly and reports an error without the ANDROID_HOME variable.
Solution: Right-click This PC and choose Properties from the shortcut menu. In the displayed dialog box, click the Advanced System Settings tab and then click Environment Variables. In the System Variables dialog box, create a new ANDROID_HOME parameter.
Set the value to the installation path of the local Android SDK, and the problem will be resolved, as shown below.
Reference:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started#h2-1587519820720

Troubleshooting for Huawei's App Performance Management SDK

I encountered a few issues in the process of integrating the APM SDK. In this post, I will share these cases for you, so that you will have a sense of how to resolve them.
Issue 1: Error "miss client id" Is Reported After the APM SDK Is Integrated​The detailed error message is as follows:
I/com.huawei.agc.apms: failed to fetch remote config: client token request miss client id, please check whether the 'agconnect-services.json' is configured correctly
Click to expand...
Click to collapse
Troubleshooting​By searching through the forum, I found that the issue is caused by the absence of the AppGallery Connect plugin. For details, please refer to this forum post.
To solve the problem, just add the following code to the app-level build.gradle file:
apply plugin: 'com.huawei.agconnect'
Click to expand...
Click to collapse
Issue 2: Cannot Find the Reported APM Logs on the Device​When the APM SDK is integrated, there was no app performance data on the App performance management page. I wanted to locate the problem based on the Logcat logs on the device.
However, I wasn't sure how to find the APM logs.
Troubleshooting​I checked the APM documentation and found out how to access the logs:
Open the AndroidManifest.xml file of the app, and add the meta-data element to application.
<application>
<meta-data
android:name="apms_debug_log_enabled"
android:value=" true" />
</application>
After the APM debug log function is enabled, you can use the Logcat log filter function com.huawei.agc.apms or apms to view the logs.
Please note that only the value of resultCode is 200 indicates that the data is reported successfully.
I/HiAnalyticsSDK: SendMission=> events PostRequest sendevent TYPE : oper, TAG : APMS, resultCode: 200 ,reqID:b639daae0490c378cf242544916a9c36
Click to expand...
Click to collapse
Issue 3: No Successfully Uploaded AMPS Logs in the Logcat.​The meta-data element has been added and set to true. The contains and sending logs can be viewed in the Logcat, with the exception of the successfully uploaded AMPS logs.
Troubleshooting​The check result shows that the agconnect-services.json file was downloaded before the APM service was enabled. This indicates that it needs to be updated.
Before the service was enabled, the JSON file contained only 29 lines. After the service was enabled, more parameters were added to the file that it has contained 52 lines.
Update the JSON file, and you'll be able to view the successfully uploaded AMP logs.
Issue 4: No APM Data Displayed in AppGallery Connect While Logs Are Available​When locating this problem, I found a log in which the result code is 200. However, still no APM data is available in AppGallery Connect.
The corresponding logs are as follows:
I/HiAnalyticsSDK: hmsSdk=> events PostRequest sendevent TYPE : maint, TAG : _hms_config_tag, resultCode: 200 ,reqID:842927417075465ab9ad990e2ce92646
Click to expand...
Click to collapse
Troubleshooting​The value of TAG in the preceding log is not APMS. Therefore, it cannot be the log that indicates that the APM data is successfully loaded.
I analyzed the logs and found some authentication failure logs.
E/HiAnalyticsSDK: HttpTransportCommander=> NE-004|IO Exception.timeout
D/HiAnalyticsSDK: HttpTransportCommander=> request times: 1
I/HiAnalyticsSDK: getPubKey=> result code : -102
Click to expand...
Click to collapse
After contacting Huawei technical support, I learned that the data reporting channel of the HiAnalyticsSDK used by APM has an authentication problem.
I went to My projects > HUAWEI Analytics in AppGallery Connect and enabled HUAWEI Analytics. After a while, the authentication was successful.
Issue 5: No Related Network Request Performance Data Is Displayed.​All of the performance data is normal with the exception of the network request data, which is not displayed in AppGallery Connect.
Troubleshooting​According to the official documentation, obtaining network request data depends on the APM plugin. The data can only be obtained after the APM plugin has been correctly integrated.
To integrate the plugin, do as follows:
In the project-level build.gradle file, add the following code in dependencies:
classpath 'com.huawei.agconnect:agconnect-apms-plugin:1.4.1.305'
In the app-level build.gradle file, add the following code:
apply plugin: 'com.huawei.agconnect.apms'

Tips for Creating a Link of App Linking Using the App Linking SDK

What Is App Linking​App Linking allows you to create redirection links that work across multiple platforms including Android, iOS, HarmonyOS, and web. With links of App Linking, you can redirect users to ads, or native app content that they can share with each other. You can create app links and send them to users, or allow users to share links dynamically generated in your app. Anyone who receives a link can tap it to access the specific app content.
Enabling App Linking and Integrating the App Linking SDK​1. Click My projects in AppGallery Connect, click your project card, and select your app for which you want to enable App Linking from the drop-down list on the top.
2. Go to Grow > App Linking. If it is the first time that you use the service, click Use now.
3. Enter the App Store ID and team ID used in your signing certificate, and then click ☑.
4. Go to Project settings > General information, and download the agconnect-services.plist file under App information.
5. Open the CLI and navigate to the location of your Xcode project. Then, create a Podfile. Skip this step if a Podfile already exists.
cd project-directory
pod init
6. Edit the Podfile to add the pod dependency AGConnectAppLinking.
target 'AGC-AppLinking-2' do
pod 'AGConnectAppLinking'
end
7. Install the pod and open the .xcworkspace file to view the project.
pod install
Designing the UI​You can create a page layout in your iOS project and design the UI according to the following figure. On the page, a link of App Linking can be received and displayed.
Requesting a URL Prefix​1. Go to Grow > App Linking. Click the URL prefixes tab and click New URL prefix.
2. In the Set domain name area, enter a URL prefix.
3. Click Next. The system automatically checks whether the URL prefix is available.
Creating a Link of App Linking in Your App​1. Import AGConnectCore and AGConnectAppLinking to the AppDelegate class of the app, and call AGCInstance.startUp in the didFinishLaunchingWithOptions method for initialization.
import AGConnectCore
import AGConnectAppLinking
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
AGCInstance.startUp()
return true
}
2. Create an object named AGCAppLinkingComponents, and set urlPrefix to the URL prefix requested in AppGallery Connect. Set deepLink. Set iOS app parameters, where iosBundleId is the app package name, and iosDeepLink is the redirection link to your iOS app.
let components = AGCAppLinkingComponents()
components.uriPrefix = "https://codelab.drcn.agconnect.link"
components.deepLink = "https://developer.huawei.com/consumer/cn"
components.iosBundleId = Bundle.main.bundleIdentifier
components.iosDeepLink = "AppLinking://ios/test2=456"
components.socialTitle = "AppLinking"
3. Call components.buildLongLink to generate and obtain a long link.
longLinkLabel.text = components.buildLongLink().absoluteString
4. Call components.buildShortLink to generate and obtain a short link.
components.buildShortLink { [self] (shortLink, error) in
if let e = error {
let alert = UIAlertController.init(title: "Error", message: e.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction.init(title: "OK", style: .cancel, handler: nil))
self.present(alert, animated: true, completion: nil)
return
}
shortAppLinking = shortLink?.url.absoluteString
shortLinkLabel.text = shortAppLinking
}
5. In the method of sharing a link, the short link, generated by the App Linking SDK, is copied to the system clipboard.
@objc func shareLink() {
UIPasteboard.general.string = shortAppLinking
}
Receiving a Link of App Linking in Your App​1. If you want the link of App Linking to be a custom URL, set a custom URL scheme under TARGETS > Info > URL Types in Xcode. Set URL Schemes to AppLinking.
2. Import AGConnectCore and AGConnectAppLinking to the AppDelegate class of the app, and call AGCInstance.startUp in the didFinishLaunchingWithOptions method for initialization.
import AGConnectCore
import AGConnectAppLinking
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
AGCInstance.startUp()
}
3. Call the AGCAppLinking.instance().handle method, and process the received link event in the callback.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let vc = ViewController()
let nav = UINavigationController(rootViewController: vc)
self.window?.rootViewController = nav
AGCInstance.startUp()
AGCAppLinking.instance().handle { (link, error) in
let deepLink = link?.deepLink
vc.getDeepLink(deeplink: deepLink)
}
self.window?.makeKeyAndVisible()
return true
}
4. Implement the application: openURL: options: method, and return the value of AGCAppLinking.instance().openDeepLinkURL(url).
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
let isAppLinking = AGCAppLinking.instance().openDeepLinkURL(url)
return isAppLinking
}
Compiling and Testing Your App​1. In Xcode, run your app on a mobile phone or simulator.
2. Click Create App Linking to generate a long link and a short link using the App Linking SDK.
3. Click Share short App Linking to copy the short link to the clipboard.
4. Paste the short link to a browser and access the link. Click Open to launch your app as prompted.
Congratulations​Well done. You have successfully built an app that integrates App Linking of AppGallery Connect and learned how to:
Create a sharable link using the App Linking SDK.
Launch your app through the configured link and receive the deep link using the App Linking SDK.

Categories

Resources