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

Build failed with "Namepace not specified" error #157

Open
prtkgrg opened this issue Oct 3, 2024 · 7 comments
Open

Build failed with "Namepace not specified" error #157

prtkgrg opened this issue Oct 3, 2024 · 7 comments

Comments

@prtkgrg
Copy link

prtkgrg commented Oct 3, 2024

image

@Shinku1014
Copy link

edit android/settings.gradle

plugins {
id "com.android.application" version "7.4.2" apply false
}

edit android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

My colleague told me to do so. I don't know why but it works.

@michalss
Copy link

i do have a same issue... any fix would be greate.

@BrokenRepository
Copy link

edit android/settings.gradle

plugins {
id "com.android.application" version "7.4.2" apply false
}

edit android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

My colleague told me to do so. I don't know why but it works.

This fixes the issue for me too. Also it works because you are setting the version of gradle you use to be compatible with the one flutter_js uses. As for if any other issues will pop up because of it, I guess I'll find out eventually.

@michalss
Copy link

that is the problem i dont want/ i cannot downgrade gradle.. :(

@evanhh191
Copy link

that is the problem i dont want/ i cannot downgrade gradle.. :(

Oh, in that case, you'll have to set up the package as a local dependency and go into their gradle files and update them to match yours. If you need help doing it, chatgpt and google are your friends.

I ended up having to set up a local dependency anyway in order to get a proper release build, so you may as well.

@emilekm2142
Copy link

emilekm2142 commented Nov 6, 2024

If you run newest dart, flutter and gradle you probably have to edit the plugin

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not open cp_settings generic class cache for settings file 'C:\Users\emile\Documents\Code\XXXXXX\wear\android\settings.gradle' (C:\Users\emile.gradle\caches\7.6.3\scripts\336uqv0bm2kn9xc0ul77aekqb).

BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 65

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 2s

edit android/settings.gradle

plugins {
id "com.android.application" version "7.4.2" apply false
}

edit android/gradle/wrapper/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

My colleague told me to do so. I don't know why but it works.

HERE IS A FIX:
Download this repo. Copy to root folder of your project (same place where your pubspec lies).

add

flutter_js:
   path: flutter_js

to your pubspec dependencies

Delete EXAMPLES subproject
Go to android/gradle/wrapper/gradle-wrapper.properties and change distributionUrl version number to the one your are using in your project. You can check it in your gradle-wrapper.properties in the root app (ctrl+shift+f, distributionUrl).

Go to flutter_js/android/build.gradle and edit
dependencies {
classpath 'com.android.tools.build:gradle:X.X.X'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
so that X.X.X is the same version you used to modify previous file.
Go to flutter_js/android/build.gradle and add namespace 'io.abner.flutter_js' to android{} section
delete package property from in android/src/main/AndroidManifest.xml

You can leave a reaction if this helps <3

@denny99
Copy link

denny99 commented Nov 7, 2024

I am not quite sure if the gradle version conflict is actually the issue here.

The latest AGP just requires the namespace attribute to be present in the build.gradle.

I've only edited the build.gradle manually and added the namespace attribute. It compiles and runs without any issue.

image

denny99 pushed a commit to denny99/flutter_js that referenced this issue Nov 7, 2024
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