Flutter - Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' - flutter

Today suddenly my app stopped working (can't build anymore), although I was able to build couple hours earlier.
the issue is that OneSignal depends on some google services which come back as forbidden, this is what I get:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve com.google.android.gms:play-services-basement:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-location:15.0.1
project :app > com.google.android.gms:play-services-places-placereport:15.0.1
> Failed to list versions for com.google.android.gms:play-services-basement.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-basement/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-basement/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-basement/maven-metadata.xml'. Received status code 403 from server: Forbidden
> Could not resolve com.google.android.gms:play-services-tasks:[15.0.1,16.0.0).
Required by:
project :app > com.google.android.gms:play-services-location:15.0.1
> Failed to list versions for com.google.android.gms:play-services-tasks.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-tasks/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-tasks/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-tasks/maven-metadata.xml'. Received status code 403 from server: Forbidden
I had an issue before when updating flutter itself where I had to use a VPN to be able to update, is this the same thing? I searched Github issues and stack overflow questions but none fixed the issue, also compared this app to others I've built but the implementation is identical (OneSignal wise) and they seem to work fine, what could be the cause of this?
NOTE: I also get this issue even when using a VPN

Thanks for everyone who commented on the question, but I saw these resources before, fortunately though, I was able to fix it by doing the following:
1- Inside build.gradle (app level), I bumped up one signal gradle from
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
to
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.10'
2- Inside build.gradle (project level), I bumped up gradle from
classpath 'com.android.tools.build:gradle:3.5.0'
to
classpath 'com.android.tools.build:gradle:4.1.3'
3- Inside gradle > wrapper > gradle-wrapper.properties I updated gradle from
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
4- Updated one signal package to version ^2.6.3 instead of ^2.6.1 (I don't think it did something but yeah)

Related

Updating an old application caused this error => Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

Installed an app from git-hub to update it, using flutter 1.22.6 (because the app was built using this version) but facing this error when running the code.
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 17.3.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.6
> Failed to list versions for com.google.firebase:firebase-messaging.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'. Received status code 403 from server: Forbidden
Could not resolve com.google.android.gms:play-services-ads-identifier:[15.0.0, 16.0.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.6
> Failed to list versions for com.google.android.gms:play-services-ads-identifier.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml'. Received status code 403 from server: Forbidd
en
Could not resolve com.google.android.gms:play-services-base:[10.2.1, 16.1.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.6
> Failed to list versions for com.google.android.gms:play-services-base.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml'. Received status code 403 from server: Forbidden
because your project has old dependencies I suggest doing a Flutter clean.
but the error says that you don't have permission to download from the link. I think connect to VPN should solve this issue
For error related to 4XX, replace jcenter() with mavenCentral() in build.gradle file.
repositories {
google()
jcenter() //remove this
mavenCentral() //add this
}

when i run my flutter app ,there emerge a unexpected problem , error :

What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve project :path_provider_macos.
Required by:
project :app > project :path_provider
Unable to find a matching configuration of project :path_provider_macos: None of the consumable configurations have attributes.
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.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
Some imports are missing. Try flutter pub get to update packages, or flutter pub cache repair, which will re-import all dependencies.
thank everyone , i get the solution about my problem : go to your Flutter sdk folder ,then go to .pub-cache\hosted\pub.dartlang.org\ ,if there have a path_provider_macos-0.0.4 folder ,delete it ,if no ,you try go .pub-cache\hosted\pub.flutter-io.cn\ , and remove path_provider_macos-0.0.4 folder
Deleted the folder you said,but show this wrong : Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_macos.
The following is detailed:
> A problem occurred configuring project ':flutter'.
> Could not resolve all dependencies for configuration ':flutter:embed'.
> Could not resolve project :path_provider_macos.
Required by:
project :flutter
> Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_macos.
> Could not resolve project :path_provider_linux.
Required by:
project :flutter
> Project :flutter declares a dependency from configuration 'embed' to configuration 'default' which is not declared in the descriptor for project :path_provider_linux.

Please I keep getting this error when I try to run my flutter app

What went wrong: Could not determine the dependencies of task
':app:compileDebugJavaWithJavac'. > Could not resolve all task
dependencies for configuration ':app:debugCompileClasspath'. > Could
not find
io.flutter:flutter_embedding_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by: project :app > Could not find
io.flutter:x86_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by: project :app > Could not find
io.flutter:x86_64_debug:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by: project :ap
Make sure you're on master branch and your flutter upgraded to last version.
then if the error remain delete the .gradle cache folder in youre home and applying ./gradlew cleanBuildCache in the project's android sub directory.

Eclipse Gradle Plugin 'could not fetch model of type'

I am running Eclipse Luna on OS X with Gradle IDE 3.6.1 and anytime I try to select a project from the gradle tasks panel I get the following error:
org.eclipse.osgi.internal.framework.EquinoxConfiguration$1
Could not fetch model of type 'EclipseProject' using Gradle distribution
'https://services.gradle.org/distributions/gradle-2.0-bin.zip'.
Has anyone else run into this error? I can get to the URL specified to download the file myself. So, network connectivity shouldn't be the problem.
The problem is for the java version configured by default on the IDE (Eclipse or Spring Tool Suite). The error is the following:
To fix it, you can set the Java version supported by the Gradle version in Configure Workspace Setting option.
Finally, you can refresh your project o continue with your creation. Later all will be perfect.
I had the same error in Eclipse Neon (version numbers were different, but otherwise same error). It looks like several different things can cause this error, but for me it was an incorrect property in [MyProject]/.settings/org.eclipse.buildship.core.prefs.
I had
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
but it needed to be
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(2.13))
2.13 should be replaced with whatever version number output you get from gradle -version.
Coming back to add this:
It turns out, the actual root problem was an incompatibility between Gradle versions. My build.gradle file worked fine with an old version of Gradle, but uses things that were deprecated and removed in later versions.
Solution is to click Finish immediately in the wizard instead of Next, and then fix the issues in the build.gradle.
Bad reference in config.
Overwrite configuration:
Project -> Properties -> Gradle -> Override workspace settings ->
Specific Gradle version -> 4.x
You need to update Gradle
Goto:
Select 'Help > About Eclipse' (on Macs this is 'Eclipse > About Eclipse').
Click the 'Installation Details' button to display the installation details dialog. Look in the 'Installed Software' tab to see all the installed plugins.
Search for Gradle(Eclipse Plug-ins for Gradle) and Update.
It might take some time for first time after that.
Reason why it happens, cause new version of gradle is available to download. Once you download new version of gradle, your error will go away.
http://gradle.org/downloads
I had the same error message using Eclipse 4.5
In my case the build file was having a error and I had to modify this line
eclipse.classpath {
plusConfigurations += configurations.providedCompile
}
into this
eclipse.classpath {
plusConfigurations += [configurations.providedCompile]
}
After that everything worked again.
I met the same problem, somebody suggested that the gradle project may be build by a old version.
I solve the problem by the following step:
modify the configuration in Eclipse, perfrence ->gradle ->gradle distribution . point it to an older version.
delete the file in ./gradle/wrapper
reload the program
In my case, I forgot to put ending apostrophe ' for a value
I ran into a similar issue recently - even blowing away the project and repulling a fresh copy from git didn't fix it. I realized it wasn't specific to the project when I reproduced it outside of Eclipse:
$ ./gradlew tasks
FAILURE: Build failed with an exception.
* What went wrong:
Expecting a stack map frame
Exception Details:
Location:
build_euvk0e0guiuwrf8fgn8svi2fy.run()Ljava/lang/Object; #16: aconst_null
Reason:
Error exists in the bytecode
Bytecode:
0x0000000: 2abb 0022 592a 2ab7 0025 ba00 3300 00b0
0x0000010: 01b0
What did fix it was removing the gradle cache:
$ rm -r ~/.gradle/caches
$ ./gradlew tasks
Somehow the version of gradle there had become corrupted (possibly related to Eclipse groovy plugin - I had this issue regularly until uninstalling it), and blowing it away forced it to get a fresh copy.
Hopefully this answer helps someone else avoid pulling out their hair.
I had a very similar issue and removing the following from my build.gradle fixed it. The same bit of config works in all other Gradle projects I have but for some reason not this one...
allprojects {
...
apply plugin: 'eclipse-wtp'
...
// remove this eclipse config to make the error go away
eclipse {
classpath { defaultOutputDir = file('build-eclipse') }
}
...
}
Open the CMD and enter there gradle --gui, change the settings of the gradle gui in the register Setup to Stack trace Output: Full Stack trace [-S] and the log level to info. Then change the current directory to the directory your build.gradle file is located and then go to the first register and let process the gui this files.
An error message should be displayed. There you find out what is wrong with your build.gradle file. In my case there was a folder missing and this causes this error.
This error can also be caused by a syntax error in the previous line of build.gradle. If so, the error has nothing to do with the Gradle or Eclipse version you are running. See this question
In my case i changed the Gradle version from 4.7.rc2 to4.6 and then it started to work.
I am on eclipse Oxygen (4.7.2), I was getting similar exception while importing the project and this worked for me:
While importing on windows Import Options
Click Configure Workspace Setting (which will take to preference window)
Select Local Installation directory (for me 'graddle wrapper' was selected)
apply, close and continue import
Below is the error I was getting
Loading Gradle project preview failed due to an error in the referenced Gradle build.
Could not fetch model of type 'GradleBuild' using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
_BuildScript_
org.gradle.tooling.BuildException: Could not fetch model of type 'GradleBuild' using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57)
at Caused by: java.lang.ClassNotFoundException: _BuildScript_
at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler$ScriptClassLoader.loadClass(DefaultScriptCompilationHandler.java:386)
... 77 more
None of the solutions worked for me and I'm having the same errors on STS 4 with eclipse Version: 2.2.600.v20190605-1800. My steps were:
Delete the project from my workspace
./gradlew cleanEclipseWtp cleanEclipse eclipseWtp eclipse
Import the project as an existing eclipse project (not an existing gradle import)
That worked!
Deleting .gradle folder from the project resolved my problem.
I got this error with Eclipse 2021-06, Java 1.8.0, gradle 4.4.
I tried deleting gradle wrapper binary folder, predefining gradle version, etc.
The thing that helped was just specifying gradle home directory and java home directory after selecting overriding workspace configuration.
Eclipse 4.4.1 broke Gradle Eclipse support with non-string values in system properties.This is fixed in the latest Gradle for the 3.6.2 release. Update your Gradle form this update-site: http://dist.springsource.com/snapshot/TOOLS/gradle/nightly

Eclipse 'refresh automatically' and Maven build interference

I recently configured Eclipse (ver. 3.6) in order to make it automatically refresh projects in the workspace (Windows > Preferences > General > Workspace > Refresh Automatically).
Since I changed this configuration I have the following problem when I try to run Maven (Maven install from Eclipse) to build a big project:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project ProjectName: Failed to clean project: Failed to delete C:\ProjectName\target -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The problem occurs randomly (more or less 50% of the times I build a single project), but when I try to build 14 projects all together I always get this error somewhere.
I think that the problem is that Maven is trying to delete files that are locked by Eclipse (that is refreshing the project). In fact it doesn't happen when I disable the "Refresh Automatically" option.
Does anybody know a trick to avoid this trouble?
I noticed there is another question "Eclipse automatically refresh resources and exclude build dir" about this topic, but there are no answers. I hope I provided enough information to understand the problem.
This occurs because something, most likely eclipse, has a lock on the file during refresh so when maven tries to clean (i.e. delete the target directory), it fails. Don't refresh automatically; I typically only have eclipse refresh the workspace when it initially runs.
I think it was bug in Eclipse in earlier version, as it should not block any files inside target folder.
I had this issue before myself, but don't run into in recent years.
So if you do, raise bug at https://bugs.eclipse.org/bugs/ against m2e or what may be more suitable.