I setup my project for flavors build (Google & Huawei) according to this doc - https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-config-flavor.
Here are my build scripts. I have tried including the signature in the release build with no change.
app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myapp.testapp"
}
flavorDimensions "platform"
productFlavors {
huawei {
versionCode 1712
versionName "1.7.12"
targetSdkVersion 29
minSdkVersion 26
buildTypes {
resValue("string", "ad_app_id", "103959507")
release {
resValue("string", "ad_id", "g87ta7hatb")
minifyEnabled true
proguardFiles 'proguard.cfg'
debuggable = true
}
debug {
resValue("string", "ad_id", "testf9tx29xur5")
debuggable = true
}
}
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '29.0.2'
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.arch.core:core-runtime:2.1.0'
implementation 'androidx.arch.core:core-common:2.1.0'
huaweiImplementation 'com.huawei.hms:ads-lite:13.4.32.300'
huaweiImplementation 'com.huawei.agconnect:agconnect-apms:1.3.1.300'
huaweiImplementation 'com.huawei.agconnect:agconnect-core:1.4.1.300'
huaweiImplementation 'com.huawei.agconnect:agconnect-crash:1.4.1.300'
huaweiImplementation 'com.huawei.hms:iap:5.0.1.300'
}
apply plugin: 'com.huawei.agconnect'
project build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://developer.huawei.com/repo/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.huawei.agconnect:agcp:1.3.0.300'
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://developer.huawei.com/repo/'
}
}
}
The environment is failing with 60054: url is null.
The gradle build is also picking up the file location:
--W- The variant: huaweiRelease, Use the json file: /Users/xxx/Documents/myappGoogle/app/src/release/agconnect-services.json
I have tried the flavor tags and have tried placing the json file within the flavor directory as the post stated here - https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201313999391430187&fid=0101187876626530001. The file so far has been picked up when placed in the app directory, the src/debug(release) directories, and also in the src/flavor directories. I can clearly see in the build logs that the correct file is being found by the build script.
What's also odd to me is the documentation:
https://developer.huawei.com/consumer/en/doc/development/HMS-References/iap-ExceptionHandlingAndGeneralErrorCodes-v4
says that 60054 is iap is not supported in this country, but the actual code is returning 60054: url is null.
The error code being returned, iapApiException.getStatus()
is returning status.statusCode = 60054
and status.getStatusMessage = "url is null".
This is from isEnvReady which is in contradiction to the aforementioned documentation in which status code 60054 should be OrderStatusCode.ORDER_ACCOUNT_AREA_NOT_SUPPORTED
where as if this was actually a url error I would expect error 60001
OrderStatusCode.ORDER_STATE_PARAM_ERROR
or something along those lines.
I am thinking of the possibility with merge issue due to this document:
https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/Environment_installation
The reason for my suspicion is that my AndroidManifest is clearly missing the appid that is supposed to be included through the scripts.
Am I missing something here? What is your suggestion or what else should I look into? Thanks.
1.Please check whether you have copy the agconnect-services.json file to the folder of each build type.
2.Please check whether you have modify configuration files to adapt to multiple flavors.
For details, see the documentation.
The result code of 60054 may be returned when HUAWEI IAP is supported by a country or region but there is a service error. In this case:
Please provide your appid to check the info.
Please provide full log: adb logcat >xxx.log to obtain it.
This is not the issue with the flavor build but it is the issue with using USA HUAWEI ID in testing. The right solution is a developer should create another non-USA HUAWEI ID and then log into the phone. After opening App Gallery App, change the Settings of country to a country that supports IAP(for example like UK). Remove USA SIM card and then use the IAP service after connecting to the changed country in the Setting using VPN.
Related
I am originally using Unity 2021.1.22f1
I have made a cardboard vr app for android and I need to make an update to it. I am not
using in app purchases or something similar, but I use the Play Asset Delivery package
for unity in order to minimize the app size. I successfullyu built the app and it throws
an error when I upload the app for internal testing and it will not proceed if this is not
resolved.
We have detected that this app is using an unsupported version of Play Billing.
Please upgrade your Billing Library to version 4 or later to publish this app.
When I click the "learn more" button it redirects me to this link:
https://developer.android.com/google/play/billing/deprecation-faq
and the internal test button is greyed out.
It is saying that the Google Play Billing Library must be upgraded from version 3 to at least
version 4.
Due to this forum thread https://forum.unity.com/threads/important-update-google-play-billing-library-v4.1315443/
I searched about the changelog in the unity versions https://docs.unity3d.com/Packages/com.unity.purchasing#4.4/changelog/CHANGELOG.html.
In this changelog is written, that the "GooglePlay - Google Play Billing Library version 4.0.0" is added in IAP 4.4.0 and date 2022-07-11.
So I guessed that i had to upgrade the unity version. I downloaded Unity 2022.1.23f1 and built the same app with the current settings
(Google Play Billing Library v3) and it was successfully built without errors.
I found a way to upgrade the library by downloading the unity package of Play Billing Library
from this website https://developers.google.com/unity/packages#google_play even if it
is saying version 3.2.4 . When I tried to build it a new error appeared:
Gradle Error: Colliding Attributes
The attribute
meta-data#com.google.android.play.billingclient.version#value=3.0.3
in :billing-4.0.0: collides with another value
(See the Console for details)
I tried updating the Play Asset Delivery package but there was no change in the error message.
I found this in my search for the bug https://github.com/RevenueCat/purchases-unity/issues/37#issuecomment-780970405.
In this link, the Google Play Billing Library is having a conflict with the same library
inside the IAP and it suggest a code to bypass the IAP library. and tried it, but to no avail.
After trying this I guess that there is a Google Play Billing Library v3 in the Play Asset Delivery package that probably is
needed to be bypassed.
If the Play Billing Library can be completely skipped it would be the best, because there is no billing function planned
to be implemented in the app, but I mainly want to be able to upload it to the playstore.
This is the mainTemplate.gradle file:
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each { project ->
project.repositories {
def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/")
maven {
url "https://maven.google.com"
}
maven {
url "https://android-sdk.is.com/" // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9
}
maven {
url "https://maven.google.com/" // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:17, Assets/IronSource/Editor/IronSourceSDKDependencies.xml:25
}
mavenLocal()
mavenCentral()
}
}
// Android Resolver Repos End
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.google.protobuf:protobuf-lite:3.0.0'
// Android Resolver Dependencies Start
implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:17
implementation 'com.google.android.gms:play-services-basement:17.2.1' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:25
implementation 'com.google.android.play:asset-delivery:2.0.0' // Assets/GooglePlayPlugins/com.google.play.assetdelivery/Editor/Dependencies.xml:3
implementation 'com.google.android.play:core-common:2.0.0' // Assets/GooglePlayPlugins/com.google.play.core/Editor/Dependencies.xml:3
implementation 'com.ironsource.sdk:mediationsdk:7.2.5' // Assets/IronSource/Editor/IronSourceSDKDependencies.xml:9
// Android Resolver Dependencies End
**DEPS**}
// Android Resolver Exclusions Start
android {
packagingOptions {
exclude ('/lib/armeabi/*' + '*')
exclude ('/lib/armeabi-v7a/*' + '*')
exclude ('/lib/mips/*' + '*')
exclude ('/lib/mips64/*' + '*')
exclude ('/lib/x86/*' + '*')
exclude ('/lib/x86_64/*' + '*')
}
}
// Android Resolver Exclusions End
android {
aaptOptions {
noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
}
compileSdkVersion **APIVERSION**
buildToolsVersion '**BUILDTOOLS**'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion **MINSDKVERSION**
targetSdkVersion **TARGETSDKVERSION**
ndk {
abiFilters **ABIFILTERS**
}
versionCode **VERSIONCODE**
versionName '**VERSIONNAME**'
consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**
}
lintOptions {
abortOnError false
}
**PACKAGING_OPTIONS**
}**REPOSITORIES**
**IL_CPP_BUILD_SETUP**
**SOURCE_BUILD_SETUP**
**EXTERNAL_SOURCES**
I want to implement push notification.
I added to project level:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
and to app level:(at the bottom of the file)
....
compile 'com.squareup.okhttp3:okhttp:3.3.0'
}
apply plugin: 'com.google.gms.google-services'
Then I added google-services.json file to project in app level
But, when I syncro gradle, it launch the error:
No matching client found for package name "...."
In gradle I have 2 different build variants , and look like:
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="es.xxx.awsomeapp">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".realm.XXXXXX"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher_chv"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
And finally the gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven { url "https://jitpack.io" }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
mavenCentral()
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
productFlavors {
vanilla {
applicationId "es.xxx.awsomeApp"
resValue 'string', 'app_name', "Awsome"
}
chv {
applicationId "es.xxx.awsomeApp.chv"
resValue 'string', 'app_name', "Awsome CHV"
signingConfig signingConfigs.chv_release
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Auxiliar libraries
compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0-beta2'
//Auxiliar libraries
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'org.igniterealtime.smack:smack-android-extensions:4.2.0-beta2'
compile 'org.igniterealtime.smack:smack-tcp:4.2.0-beta2'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta2'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.orhanobut:logger:1.15'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.github.Slyce-Inc:SlyceMessaging:1.1.2'
compile 'io.realm:android-adapters:1.4.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.rengwuxian.materialedittext:library:1.8.3'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.3.0'
compile 'com.google.firebase:firebase-messaging:9.8.0'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
testCompile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'org.igniterealtime.smack:smack-tcp:4.2.0-beta2'
testCompile 'com.android.support.constraint:constraint-layout:1.0.0-beta2'
testCompile 'com.android.support:design:24.2.1'
testCompile 'com.orhanobut:logger:1.15'
testCompile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
testCompile 'com.github.Slyce-Inc:SlyceMessaging:1.1.2'
}
apply plugin: 'com.google.gms.google-services'
And the firebase console.
How can I solve it?
Note, that json files are each one of their project.
Just go to the google-services.json
change the package-name to the name of your package
{
"client_info": {
"mobilesdk_app_id": "1:113908578702:android:a0a98decfd9f22466f4cdf",
"android_client_info": {
"package_name": "com.example.Appname"
}
}
}
sync your project, it'll be solved
I was facing the same error. I am using multiple flavors. Therefore, I put the google-services.json in app/src/{flv} directory.
It worked well for one flavor but did not work for others. The issue was that I have also placed google-services.json corresponding to flavor for which it was working in app directory also.
Google will search for sub-directories / flavor directories only if it did not find the google-services.json in the app directory.
So, make sure you don't put google-services.json in app directory in case you have separate google-services.json for multiple flavors.
Please see this article for mode details on Android product flavors.
I had the same problem, so using Android Studio 2.3.3 I used the menu
Tools> Firebase - on the right side of the window click Notifications and then Recieve notifications on your app,finally click Connect to Firebase, after this you will see a dialog saying This app is already connected to a project but just click Sync, then firebase will sync automatically all your app clients and it will fix this issue,by the way I know it's too late to respond but it might help someone.
If you have added google-service.json file
check build.gradle(: app) package_name and in google-service.json file package_name is the same
Also if you have added productFlavors make sure you have added that package in firebase for creating JSON file
Check your Gradle app level applicationId, it should be same as firebase package name, then it works like a charm
*Go to build.gradle and change the package name with same as AndroidManifest.xml and sync again *
[1][In this image show package name in AndroidManifest same as build.gradle]
[1]: https://i.stack.imgur.com/T4cqz.png
[Below image show package name in build.gradle same as AndroidManifest]
[2]: https://i.stack.imgur.com/ModHS.png
[package name in build.gradle][2]
Also check firebase and download recent .json file.
Update your applicationId inside defaultConfig of app level gradle file. With your package name.
Try to download the latest google-services.json file
it's a bit late, but maybe it could help someone like me with the same situation. I defined another app in the Firebase console at project settings with a different package name equal to my other flavor build. and then I downloaded the new google-services.json file and used it.it worked like a charm for me
Flutter firebase auth UI have some issue, because of firebase_auth version miss match issue
My flutter app crashed and unable to identify an issue, after opening in an android studio, I got the issue and it is here
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mycom.mypetshop. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common##16.0.2:240)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin.<init>(FirebaseAuthPlugin.java:54)
at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin.registerWith(FirebaseAuthPlugin.java:47)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:20)
at com.vyapari2online.mypetshop.MainActivity.onCreate(MainActivity.java:11)
at android.app.Activity.performCreate(Activity.java:5990)
How to solve this?
In project 'app' a resolved Google Play services library dependency
depends on another at an exact version (e.g. "[15.0. 1]", but isn't
being resolved to that version. Behavior exhibited by the library will
be unknown.
Dependency failing: com.google.android.gms:play-services-flags:15.0.1
-> com.google.android.gms:play-services-basement#[
15.0.1], but play-services-basement version was 16.0.1.
The following dependencies are project dependencies that are direct or
have transitive dependencies that lead to the art ifact with the
issue.
-- Project 'app' depends on project 'firebase_auth' which depends onto com.google.firebase:firebase-auth#16.0.2
-- Project 'app' depends on project 'firebase_core' which depends onto com.google.firebase:firebase-core#16.0.4
-- Project 'app' depends on project 'cloud_firestore' which depends onto com.google.firebase:firebase-firestore#17.1.1
-- Project 'app' depends on project 'google_sign_in' which depends onto com.google.android.gms:play-services-auth#16.0.1
For extended debugging info execute Gradle from the command line with
./gradlew --info :app:assembleDebug to see the dep endency paths to
the artifact. This error message came from the google-services Gradle
plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding
"googleServices { disableVersionCheck = false }" to your b uild.gradle
file.
#flutter_firebase_ui have a lot of issues #google please hire me, I can help your developers
Dependency Configuration
For the gradle issue, make sure your Android SDK and Firebase/Firestore plugins are compatible versions are compatible. Here's what worked for me:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-auth:16.0.5'
}
In the module/app build.gradle:
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.timeswap.timeswapcore"
minSdkVersion 17
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
}
Specifically, pay attention to the compileSdkVersion, targetSdkVersion, and the version numbers of google-services and firebase_auth. Fiddling with those numbers eventually led me to this config, and it may help you find your appropriate config.
Firebase or Firestore Initialization
As for the App initialization, I have this
Firestore firestore = Firestore.instance;
firestore.settings(timestampsInSnapshotsEnabled: true);
in my _initFirestore, which is called right after super.initState()
#override
void initState() {
super.initState();
_initFirestore();
checkCurrentUser();
}
Firebase (and all other Firebase plugins that I've used) is initialized similarly, but with the firebase_core: dependency instead of cloud_firestore: in pubspec.yaml.
For instance, from the flutter/plugins/packages/firebase_storage GitHub repo:
void main() async {
final FirebaseApp app = await FirebaseApp.configure(
name: 'test',
options: FirebaseOptions(
googleAppID: Platform.isIOS
? '1:159623150305:ios:4a213ef3dbd8997b'
: '1:159623150305:android:ef48439a0cc0263d',
gcmSenderID: '159623150305',
apiKey: 'AIzaSyChk3KEG7QYrs4kQPLP1tjJNxBTbfCAdgg',
projectID: 'flutter-firebase-plugins',
),
);
final FirebaseStorage storage = FirebaseStorage(
app: app, storageBucket: 'gs://flutter-firebase-plugins.appspot.com');
runApp(MyApp(storage: storage));
}
You can also use this Medium post as a guide to get started with the flutter Firebase Auth UI.
For future reference, you can navigate to flutter/plugins/packages/{package name} on Github and find main.dart inside of examples/lib for a demo. Feel free to leverage this to solve your dependency issue as well!
You need to initialize the FirebaseApp before using it. You can add it to your onCreate method.
#Override
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
}
Also make sure you have the dependency in your build.gradle
dependencies {
....
}
apply plugin: 'com.google.gms.google-services'
I also face same issue and solved by adding Facebook app id in AndroidManifest.xml
Try run Android app with Android studio you will get the error message
I am trying to build my react-native project and using react-native fbsdk.
However, I get these errors:
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
/home/luiz/MYP/app/node_modules/react-native-fbsdk/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
:react-native-fbsdk:processReleaseResources FAILED
My current OS is Linux Elementary 0.4.1 Loki x64.
I am using react-native#0.37.0 and, because of this, react-native-fbsdk#0.4.0.
I've already tried:
cd android && ./gradlew clean
delete the project and re npm install it
and try in Android API's 23 and 24.
Apparently facebook has updated their sdk yesterday and the latest (4.23.0) sdk may have a bug or something.
You can resolve this by Changing your node_modules\react-native-fbsdk\android\build.gradle from:
compile('com.facebook.android:facebook-android-sdk:4.+')
To:
compile('com.facebook.android:facebook-android-sdk:4.22.1')
I'm no gradle guy so if someone knows of a better way of forcing the version from parent gradle.build, please comment and I'll update the answer.
** EDIT **
#Andreyco managed to solve this without changing node_modules. You can scroll down to his answer or click here.
Also, as notified by #JuanJoseTugores there's a pull request in react-native-fbsdk waiting to be approved, so you can check the bug's progress and be notified when it's resolved.
** Another Update **
Facebook closed the bug that was opened for them regarding this issue, saying they fixed the sdk. So now all the workarounds can be removed.
Apparently FB still not solved this. We just upgraded to RN 0.44 & FB 0.6.0
After digging into gradle, I came up with following solution.
Key is to exclude facebook-android-sdk required by react-native-fbsdk and pull in desired (working) version on facebook-android-sdk module - preferably without modifying anything in node_modules folder.
Fortunately, gradle offers this.
// android/app/build.gradle
dependencies {
compile(project(':react-native-fbsdk')){
exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
}
compile "com.facebook.android:facebook-android-sdk:4.22.1"
}
I was able to resolve this without modifying files under node_modules/.... I upgraded our react-native-fbsdk version to 0.6.0 and then add this to our application's build.gradle file to pin facebook-android-sdk at version 4.22.1:
project(':react-native-fbsdk') {
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.22.1'
}
}
}
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.22.1'
...
}
}
Edit: We are building with:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
...
}
I just encountered this error. First, RN Facebook SDK v.0.6.0 only works for react-native >= 0.44.0, so you have to update your dependency in package.json to react-native: ^0.44.0. Then go to Android build.gradle file and make this changes: compileSdkVersion 25 and compile "com.android.support:appcompat-v7:25.0.0"
this fixed for me
in android/build.gradle
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
}
}
}
}
For those who are looking for make it work using RN 0.42 which by now is the one with react version stable you may need to use the Facebook SDK 4.18.0 "com.facebook.android:facebook-android-sdk:4.18.0" which is the one that was released by the time that react-native-fbsdk#0.5.0 was released, otherwise you may be ending up with the issue: https://developers.facebook.com/bugs/1712442065726889/
Besides, if you are getting hard times to force the facebook sdk to be what you need try this:
android/app/build.gradle
...
dependencies {
compile project(':react-native-fbsdk')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile "com.facebook.android:facebook-android-sdk:[4.18.0)"
}
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project(':react-native-fbsdk') {
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.18.0'
}
}
}
...
allprojects {
repositories {
...
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.18.0'
}
}
}
}
As you can see here there is patches incoming,
https://github.com/facebook/react-native-fbsdk/pull/339
https://github.com/facebook/react-native-fbsdk/pull/338
in the meantime if you're using react-native-fbsdk v0.5 you could do
yarn add react-native-fbsdk#https://github.com/tugorez/react-native-fbsdk
I've applied the suggested changes and it's working :) but please be aware I'll no support this and wont keep it update so... as soon as you can you should go back to the official library.
I'm new into Android Studio and Facebook SDK. I followed the guide reported here: https://developers.facebook.com/docs/android/getting-started till step 6.
but I'm unable to use none of Facebook's functions. I get compilation errors for every Facebook functions I try. Also, I get an "unable to resolve symbol" for import com.facebook.FacebookSdk.
Is there something I'm doing wrong or I should configure before importing the library? I just created a new Empty Project
here the build.gradle of the Project:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
and here the module for the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "com.ozetastudios.climbbuddy"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.facebook.android:facebook-android-sdk:3.23.0'
}
I pulled most of my hair out to figure this out, and it may not be universally applicable. But it solved this issue for me.
In your highest level build.gradle file, add the Maven Central repositories:
repositories {
jcenter() // Default repository
mavenCentral() // You add this line
}
In the app-level build.gradle file, add this block:
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
}
The SDK version has to be valid. You can check for the latest in the Maven Repo by looking here.
Now, here's the part were the Facebook Tutorial is opaque. "You can now import com.facebook.FacebookSDK" meant nothing to me, as a newbie to Android Studio (My app is in Cordova, and I usually only use Android Studio to compile) I kept trying to import that address as a module from the File > New menu. Nope. Path does not exist. Of course it doesn't. It's not a path. WTF. But then I noticed other "import" objects as lines of code in the main activity file. Light bulb. So THAT's what the Facebook Tutorial meant. It felt like unlocking Tutankhamun's puzzle.
I inserted the following line into my application's main activity file:
import com.facebook.appevents.*;
And THAT, my fellow frustrates, worked for me.