Getting started
- Firework App Id
- Flutter SDK >=1.20.0
- Dart SDK >=2.12.0 <3.0.0
- iOS project
- iOS 12 or greater.
- Xcode 13 or greater.
- Swift 5.3 or greater.
- Android Project
- JAVA_HOME 1.8 or greater
- minSdkVersion 21 or greater
- compileSdkVersion 30 or greater
- targetSdkVersion 30 or greater
Installing Firework Flutter SDK requires the following step:
- 1.Install Flutter plugin package
- 2.Setup Native project
flutter pub add fw_flutter_sdk
No configuration is required.
- build.gradle
buildscript {
repositories {
...
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
// We don’t require Gradle plugin version. But we suggest using 4+.
classpath("com.android.tools.build:gradle:4.0.1")
...
}
}
allprojects {
repositories {
...
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
- gradle-wrapper.properties
...
# We don’t require Gradle version. But we suggest using 4+.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
...
- app/src/.../MainActivity.kt
The MainActivity should extend FlutterFragmentActivity.
class MainActivity: FlutterFragmentActivity()
- app/build.gradle
...
apply from: 'firework.gradle'
- New file: app/firework.gradle
android {
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude("META-INF/*.kotlin_module")
}
}
dependencies {
// ads
implementation 'com.github.loopsocial:AndroidAdsService:v20.0.0'
// implementation 'com.github.loopsocial:AndroidAdsService:v19.5.0'
// will crash on Android 12 API 31 if your targetSdkVersion is 31 and the work-runtime-ktx version smaller than 2.7.0
// Please use the work-runtime-ktx version greater than or equal to 2.7.0 if your targetSdkVersion is 31
// implementation 'androidx.work:work-runtime-ktx:2.7.0'
}
// AAPT: error: resource android:attr/lStar not found
// solution 1: some library may dependent on 1.7.x, you can force it to 1.6.0
// solution 2: upgrade compileSdkVersion and targetSdkVersion to 31
configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
force 'androidx.core:core:1.6.0'
}
}
- FAQ(frequently asked questions)
- Gradle build daemon has been stopped: JVM garbage collector thrashing and after running out of JVM memory. Add the following configuration to the file:
gradle.properties
.
...org.gradle.jvmargs=-Xmx4g- If your Gradle plugin version is larger than
com.android.tools.build:gradle:4.1.x
. Please set thecompileSdkVersion = 31
andtargetSdkVersion = 31
. And add the following configuration to the file:src/main/AndroidManifest.xml
.
<manifest>...<application>...<activityandroid:name=".MainActivity"...android:exported="true" // sdk version 31>...</activity></application></manifest>- If you want to use JDK11 and Gradle 7.x. Please do:
- 1.JAVA_HOME = JDK11 (system env)
- 2.classpath("com.android.tools.build:gradle:7.x.x") (build.gradle)
- 3.distributionUrl=https://services.gradle.org/distributions/gradle-7.x-all.zip (gradle-wrapper.properties)
- 4.And change the following configuration in the file:
app/firework.gradle
.
android {...compileOptions {sourceCompatibility JavaVersion.VERSION_11targetCompatibility JavaVersion.VERSION_11}...}- If you met the issue like below:
> The minCompileSdk (31) specified in adependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)is greater than this module's compileSdkVersion (android-30).Dependency: androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0.Please do:configurations.all {resolutionStrategy {...force 'androidx.work:work-runtime-ktx:2.2.0'force 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'}}Maybe yourcompileSdkVersion = 30
andtargetSdkVersion = 30
, your Gradle is below 6.9-all and the Gradle plugin iscom.android.tools.build:gradle:4.1.x
.- Okhttp issue: If you met the issue like below:
/data/app/com.thesouledstore-1b4KZ7kSaE_DlLmco_iLxQ==/base.apk!classes5.dex)2022-02-25 21:06:33.506 16304-18932/? E/com.newrelic.android: TransactionStateUtil: Attempting to convert network exception java.io.IOException to error code.2022-02-25 21:06:33.508 16304-18932/? E/AndroidRuntime: FATAL EXCEPTION: OkHttp DispatcherProcess: com.thesouledstore, PID: 16304java.lang.NoSuchMethodError: No static method delimiterOffset(Ljava/lang/String;IILjava/lang/String;)I in class Lokhttp3/internal/Util; or its super classes (declaration of 'okhttp3.internal.Util' appears in /data/app/com.thesouledstore-1b4KZ7kSaE_DlLmco_iLxQ==/base.apk!classes5.dex)Maybe your okhttp version is 3.x.x . Please do:Solution: force the version to yourapp/firework.gradle
file, like below:configurations.all {resolutionStrategy {...force 'com.squareup.okhttp3:okhttp:3.12.12'force 'com.squareup.okhttp3:logging-interceptor:3.12.12'force 'com.squareup.okhttp3:okhttp-urlconnection:3.12.12'}}- Glide issue: if you met the issue like below:
GeneratedAppGlideModuleImpl is implemented incorrectly.If you've mannually implemented this class, remove your implementation.The Annotation processor will generate a correct implementation.(FastImageViewManager.java:xxx)Maybe yourreact-native-fast-image
version is >7.x.x and <8.1.4 . Please do:Solution 1: add theexcludeAppGlideModule = true
to your android/build.gradle file, like below:buildscript {...ext {excludeAppGlideModule = true...}...}Solution 2(recommended): upgrade thereact-native-fast-image
version to >= 8.1.4
Include the app ID in your app
Info.plist
file using the key FireworkVideoAppID
.See the image below:

Include the
appid
in your app AndroidManifest.xml
file, like below: <application
...
>
<activity .../>
...
// Include the app ID
<meta-data
android:name="Firework:Appid"
android:value="your firework appid" />
</application>
import 'package:fw_flutter_sdk/fw_flutter_sdk.dart';
/// Optional: set listener for SDK init
FireworkSDK.getInstance().onSDKInit = (event) {
};
/// It is recommended to call the init method when the application starts,
/// e.g. in the initState method of your AppState.
/// Init method has one optional parameter: userId.
FireworkSDK.getInstance().init();
Last modified 8mo ago