video_thumbnail icon indicating copy to clipboard operation
video_thumbnail copied to clipboard

using video_thumbnail 0.5.3 i go this error Namespace not specified.

Open hosaaam opened this issue 1 year ago • 10 comments

while i build my project i got his error A problem occurred configuring project ':video_thumbnail'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl. Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace. iam using flutter sdk :3.24.4

hosaaam avatar Nov 11 '24 15:11 hosaaam

@hosaaam have you found any workaround? I am stuck with this error as well.

Rahat-Iqbal-git avatar Nov 17 '24 09:11 Rahat-Iqbal-git

For a workaround, you can use this in your android/build.gradle file.

subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    
    afterEvaluate {
        // check if `android` block is available and namespace isn't set
        if(it.hasProperty('android') && it.android.namespace == null){
            def manifest = new XmlSlurper().parse(file(it.android.sourceSets.main.manifest.srcFile))
            def packageName = [email protected]()
            android.namespace= packageName
        }
    }
    
}

xsahil03x avatar Nov 18 '24 10:11 xsahil03x

facing same issue , will clone and apply fix

Shahidbangash avatar Nov 25 '24 17:11 Shahidbangash

i have create pull request and waiting for approval .

meanwhile you can use updated reference to my pacakge code

replace video_thumbnail: your_version_of_package with

video_thumbnail: git: url: https://github.com/Shahidbangash/video_thumbnail.git ref: master

Shahidbangash avatar Nov 25 '24 17:11 Shahidbangash

i have create pull request and waiting for approval .

meanwhile you can use updated reference to my pacakge code

replace video_thumbnail: your_version_of_package with

video_thumbnail: git: url: https://github.com/Shahidbangash/video_thumbnail.git ref: master

I'm using a package that includes the video_thumbnail package as a dependency. Is there a way for me to override with your working package?

level2fast avatar Dec 03 '24 04:12 level2fast

i have create pull request and waiting for approval . meanwhile you can use updated reference to my pacakge code replace video_thumbnail: your_version_of_package with video_thumbnail: git: url: https://github.com/Shahidbangash/video_thumbnail.git ref: master

I'm using a package that includes the video_thumbnail package as a dependency. Is there a way for me to override with your working package?

Yes , you can override that package to refer to my package instead of pubspec.yaml version until author fix this issue .

--

you will need to override the package this is referencing to video_thumbnail package

Shahidbangash avatar Dec 03 '24 11:12 Shahidbangash

i have create pull request and waiting for approval . meanwhile you can use updated reference to my pacakge code replace video_thumbnail: your_version_of_package with video_thumbnail: git: url: https://github.com/Shahidbangash/video_thumbnail.git ref: master

I'm using a package that includes the video_thumbnail package as a dependency. Is there a way for me to override with your working package?

Yes , you can override that package to refer to my package instead of pubspec.yaml version until author fix this issue .

--

you will need to override the package this is referencing to video_thumbnail package

It was fixed in ^8.3.0

https://pub.dev/packages/stream_chat_flutter/changelog

level2fast avatar Dec 05 '24 03:12 level2fast

I am facing the same issue. Let me know if there is a solution

Arfaz123 avatar Dec 16 '24 05:12 Arfaz123

Update the root android/build.gradle file as shown below:

buildscript {
    // Define global properties for the project
    ext {
        // The minimum SDK version required for the app to run
        minSdkVersion = 24

        // The SDK version used to compile the app
        compileSdkVersion = 35

        // The target SDK version that the app is optimized for
        targetSdkVersion = 35

        // The Kotlin version used for the project
        kotlin_version = '1.9.20'

        // Compatible AGP version - The Android Gradle Plugin version used for building the app
        build_version = '8.2.0'
    }
    ....
    ....
    .
    ...
    
    subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app') // Ensure dependencies are evaluated correctly

    plugins.withId('com.android.library') {
        extensions.configure(com.android.build.gradle.LibraryExtension) { android ->

            // Ensure compileSdkVersion is set
            if (!android.hasProperty("compileSdkVersion") || android.compileSdkVersion == null) {
                android.compileSdkVersion = rootProject.ext.compileSdkVersion
            }
            // Retrieve the manifest file path
            def manifestFile = android.sourceSets.main.manifest.srcFile


            // Attempt to retrieve the package name from AndroidManifest.xml
            def packageName = null

            if (manifestFile.exists()) {
                def manifestContent = new XmlParser().parse(file(manifestFile))
                packageName = manifestContent.@package
            }

            // Ensure namespace is set with fallback logic
            if (!android.hasProperty("namespace") || android.namespace == null || android.namespace.isEmpty()) {
                if (packageName) {
                    android.namespace = packageName
                } else {
                    // Set a default namespace if packageName is null
                    def defaultNamespace = "com.example.${project.name}"
                    println "Package name is null. Setting default namespace for project: ${project.name} to ${defaultNamespace}"
                    android.namespace = defaultNamespace
                }
            }
        }
    }
}

bhagat-techind avatar Dec 27 '24 14:12 bhagat-techind

Since this repo is no longer maintained, better to switch to an active fork like get_thumbnail_video.

It solved the issue for me.

biendltb avatar Feb 18 '25 10:02 biendltb