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

using video_thumbnail 0.5.3 i go this error Namespace not specified. #174

Open
hosaaam opened this issue Nov 11, 2024 · 9 comments
Open

Comments

@hosaaam
Copy link

hosaaam commented Nov 11, 2024

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

@Rahat-Iqbal-git
Copy link

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

@xsahil03x
Copy link

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 = manifest.@package.text()
            android.namespace= packageName
        }
    }
    
}

@Shahidbangash
Copy link

facing same issue , will clone and apply fix

@Shahidbangash
Copy link

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

@level2fast
Copy link

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?

@Shahidbangash
Copy link

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

@level2fast
Copy link

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

@Arfaz123
Copy link

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

@bhagat-techind
Copy link

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

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

7 participants