Closed LeandroMoura3 closed 1 year ago
@LeandroMoura3 please add your AndroidManifest
Sorry for that,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mcb.meubairro">
<application
android:label="MCB"
android:name="${applicationName}"
android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
</queries>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29"/>
</manifest>
There is.
Here is the package name and className. I think that is correct. I review it some times.
There is the console message that is show to me when I call the facebook_api call:
app_time_stats: avg=67.54ms min=7.07ms max=867.61ms count=17 W/com.facebook.internal.NativeProtocol( 4442): Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared. Please follow https://developers.facebook.com/docs/android/troubleshooting/#faq_267321845055988 to make the declaration.
Exist a chance that this message show because my keyshash is wrong?
@LeandroMoura3 this tags must be at the beginning of the Manifest tag
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
</queries>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29"/>
check the example
<manifest package="com.example.app">
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
</queries>
...
</manifest>
Also a package name must have at least 3 parts [domain extension].[domain name].[your app name] without blank spaces (instead of you must use underscore) here an valid example com.example.app
IMPORTANT Since the native facebook sdk 15.0.0 the minSdkVersion required is 21. You must go to android/app/build.gradle and define minSdkVersion to 21
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 33
...
}
Here is my new manifest version:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mcb.meubairro">
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
</queries>
<application
android:label="MCB"
android:name="${applicationName}"
android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29"/>
</manifest>
I do flutter clean, flutter run and still experiment the problem related above.
I try to change my package name to com.mcb.meubairro.MainActivity, because in my folder is this structure: app/src/main/kotlin/mcb/MainActivity.kt
My MainActivity is a flutter default activity:
package mcb.meubairro
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
@LeandroMoura3 it seems that this issue must be opened in the official facebook repo https://github.com/facebook/facebook-android-sdk due to this plugin only connect with the java code of this sdk but all the configuration is handled by the native sdk
I think that I don't have the experience in native andriod to open this issue. So, for now, I will wait and try another authentication method.
Thenk you for you support.
I think that I don't have the experience in native andriod to open this issue. So, for now, I will wait and try another authentication method.
Thenk you for you support.
You don't need experiencie with native code to open the issue Just add the all steps that you followed inside the android folder to configure this plugin
Last day II have install the google authentication. I have success with that. One of the problems that I have is put the hashkey wrog.
Can you try put your hashkey wrong to test if the message is the same as this problem? If yes, so my problem is the hashkey. If not, I open a issue on github facebook.
I don't understand your explanation about facebook SDK configurations.
@LeandroMoura3 when you put an invalid keyhash you have a different error message. Instead of
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" /> <!-- allows app to access Facebook app features -->
</queries>
try with
<queries>
<provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
<provider android:authorities="com.facebook.orca.provider.PlatformProvider" />
</queries>
If that did not work try using flutter_facebook_auth: 4.4.1+1
If you think that the key hash could be the problem (is a common problem on windows) you can follow the next documentation to generate your key hash using native code https://developers.facebook.com/docs/android/getting-started#create_hash
What version are you using?
5.0.4
What OS and version are you using to local deploy your application?
win10
What platforms are you seeing the problem on?
Android
pubspec.yaml
Describe the Bug
Even when add the queries to allow Android 30+ communication, show in console the message below and don't work authentication:
Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared. Please follow https://developers.facebook.com/docs/android/troubleshooting/#faq_267321845055988 to make the declaration.
Expected Behavior
The authentication works.
To Reproduce
I follow all steps of tutorial, includes the hash key and add MainActivity, but still not working.
Relevant log output
No response
flutter doctor -v
Info.plist (iOS)
No response
Podfile (iOS)
No response
AndroidManifest.xml
No response
MainActivity.java
No response
MainActivity.kt
No response
index.html
No response
Info.plist (macOS)
No response