bcc-code / bccm-player

[BCC Media] Flutter package for video-heavy apps
https://bcc-code.github.io/bccm-player/
Other
17 stars 11 forks source link

build error #40

Closed PURUSHOTHAM-REDDY-N closed 1 year ago

PURUSHOTHAM-REDDY-N commented 1 year ago

@andreasgangso D:\personal-projects\workspace\flutter_my_video\flutter_my_video>flutter build apk --split-per-abi

Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1620 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.

FAILURE: Build failed with an exception.

BUILD FAILED in 2m 11s Running Gradle task 'assembleRelease'... 132.9s Gradle task assembleRelease failed with exit code 1

i think the problem is in here mainactivity.kt i copied it from bcc media project mainactivity.kt

package com.example.flutter_video_player

import android.annotation.SuppressLint import android.content.res.Configuration import android.os.Bundle import android.os.PersistableBundle import android.os.StrictMode import android.view.View import android.view.Window import android.widget.FrameLayout import io.flutter.embedding.android.FlutterFragmentActivity import media.bcc.bccm_player.BccmPlayerPlugin import media.bcc.bccm_player.views.FullscreenPlayerView

class MainActivity : FlutterFragmentActivity() {

override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
    if (BuildConfig.DEBUG)
        StrictMode.enableDefaults();
    super.onCreate(savedInstanceState, persistentState)
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    requestWindowFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
}

@SuppressLint("MissingSuperCall")
override fun onPictureInPictureModeChanged(
    isInPictureInPictureMode: Boolean,
    newConfig: Configuration
) {
    super.onPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
    val bccmPlayer =
        flutterEngine?.plugins?.get(BccmPlayerPlugin::class.javaObjectType) as BccmPlayerPlugin?
    bccmPlayer?.handleOnPictureInPictureModeChanged(isInPictureInPictureMode, newConfig)
}

override fun onBackPressed() {
    if (!BccmPlayerPlugin.handleOnBackPressed(this)) {
        super.onBackPressed()
    }
}

}

andreasgangso commented 1 year ago

Yea there's a bug somewhere with xml parsing in gradle v7 or something. I had that too, and I think the root cause lies in the cast SDK.

Anyway, here's a quick fix for gradle v7.0. You can remove it when you upgrade to gradle 8. Add this to your "android/gradle.properties" file

android.enableNewResourceShrinker=false

Relevant resources:

PURUSHOTHAM-REDDY-N commented 1 year ago

it worked @andreasgangso thank you !