Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android App launch and crash (facebook_app_events 0.6.0) #38

Closed
LiveRock opened this issue Jul 6, 2020 · 6 comments
Closed

Android App launch and crash (facebook_app_events 0.6.0) #38

LiveRock opened this issue Jul 6, 2020 · 6 comments

Comments

@LiveRock
Copy link

LiveRock commented Jul 6, 2020

Hi

I followed all the instructions but have been facing this issue when using flutter_facebook_app_events package.
facebook_app_events: "0.6.0"

2 possible outcomes:

  1. App builds successfully but app launch for a second and crash without any debug output
  2. App builds successfully but app launch for a second and crash with the following error:
    Error connecting to the service protocol: failed to connect

When I remove the package, app runs fine.
Only happen in Android, iOS is OK

What did I do wrong? HELP!

@DennisAlund
Copy link
Member

"I followed all the instructions"

Please provide all configuration and additional information on what you have tried. So we can narrow down if there is a problem with the plugin or its documentation.

@LiveRock
Copy link
Author

LiveRock commented Jul 7, 2020

Doctor summary (to see all details, run flutter doctor -v):

[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.5 19F101, locale en-SG)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.6)
[!] Android Studio (version 2.3)
    ✗ Flutter plugin version 12.1 - the recommended minimum version is 16.0.0
[✓] VS Code (version 1.46.1)
[!] Connected device
    ! No devices available

pubspec.yaml

environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  flutter_icons: ^1.0.0+1
  flutter_spinkit: ^4.1.1+1
  flutter_web_browser: ^0.11.0
  avatar_letter: ^1.0.1
  url_launcher: ^5.4.1
  popup_menu: ^1.0.5
  photo_view: ^0.9.2
  camera: ^0.5.7+4
  carousel_slider: ^1.4.1
  permission_handler: ^4.2.0+hotfix.1
  email_validator: ^1.0.4
  shape_of_view: ^1.0.2
  html: ^0.14.0+3
  zefyr: ^0.11.0
  flutter_email_sender: ^3.0.1
  html_editor: ^1.0.1

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  
  dio: ^3.0.8 #latest version
  flutter_html: "^0.11.1"
  connectivity: ^0.4.8+1
  shared_preferences: ^0.5.6
  share: ^0.6.4+1 # ^0.6.3+6
  maps_launcher: ^1.2.0
  package_info: ^0.4.0+13
  device_info: ^0.4.1+4
  device_id: ^0.2.0
  image_picker: ^0.6.3+1
  image_cropper: ^1.2.1
  transparent_image: ^1.0.0
  cached_network_image: ^2.0.0
  bot_toast: ^2.2.1
  flutter_absolute_path: ^1.0.6

  xml2json: ^4.1.1
  vcard: "0.1.1"
  qr_flutter: ^3.2.0
  qr_code_scanner: "0.0.13"
  device_apps: ^1.0.9
  firebase_ml_vision: ^0.9.3+8
  location: ^2.3.5
  geocoder: ^0.2.1
  string_validator: ^0.1.3
  contacts_service: ^0.3.10
  # to convert to CSV format to be used for export contact attachment
  csv: ^4.0.3
  # This mailer supports attachment
  flutter_mailer: ^0.4.2
  keyboard_avoider: ^0.1.2
  firebase_messaging: "6.0.16"
  firebase_analytics: "5.0.16"
  facebook_app_events: "0.6.0"

  crop_edge_detection:
    git:
      url: git://github.com/anagatadev/crop_edge_detection.git

  youtube_player_flutter: "7.0.0+5"

  provider: 
  path_provider: 

  mobx: 
  flutter_mobx: 

dev_dependencies:
  flutter_test:
    sdk: flutter

  mobx_codegen:
  build_runner:


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
   - assets/images/
   - assets/images/flags/
   - assets/icons/
  
  # For localisation - Peter 22 June 2020
   - i18n/en.json
   - i18n/zh.json
 

@LiveRock
Copy link
Author

LiveRock commented Jul 7, 2020

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="default_notification_channel_id" translatable="false">kc</string>
    <string name="default_notification_channel_name" translatable="true">k</string>
    <string name="facebook_app_id">0000</string>
    <string name="fb_login_protocol_scheme">fb0000</string>
    <string name="fbapp_name">k app</string>
</resources>

build.gradle

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

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

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

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

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'

def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
    compileSdkVersion 28

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.company.app"
        minSdkVersion 24 
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
        storePassword keystoreProperties['storePassword']
        }
    }

    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.release
        }
    }

    flavorDimensions "app"
        productFlavors {
            dev {
                dimension "app"
                applicationId "com.company.app"
                versionNameSuffix "-dev"
                resValue "string", "app_name", "kDev"
            }
            staging {
                dimension "app"
                applicationId "com.company.app"
                versionNameSuffix "-stg"
                resValue "string", "app_name", "k STG"
            }
            production {
                dimension "app"
                applicationId "com.company.app"
                resValue "string", "app_name", "ky"
            }
        }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    // implementation 'com.google.firebase:firebase-analytics:17.2.2'
    // For FCM
    implementation 'com.google.firebase:firebase-messaging:20.2.0'

    //implementation 'com.facebook.android:facebook-android-sdk:5.0.0'

}

@LiveRock
Copy link
Author

HELP! I am still facing app crash on launch with Android

@DennisAlund
Copy link
Member

Please post your AndroidManifest.xml also

There are two similar issues in this repo #14 and #15 ... does those offer any leads?

@LiveRock
Copy link
Author

Issue resolved. It was malformed manifest file. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants