所以,建筑在沒有之前一直都很好。沒有添加任何新內容,沒有刪除任何內容,沒有安裝任何軟件包,什么都沒有。在構建問題出現之前,一切都很正常。這是完整的錯誤報告
> Configure project :app
Error 'Plugin-Version' of 'unspecified' for 'com.android.build.gradle.AppPlugin@4aae70b2' is not a valid version number
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.android.gms:play-services-ads-identifier:[15.0.0, 16.0.99].
Required by:
project :app > com.onesignal:OneSignal:3.16.0
> Failed to list versions for com.google.android.gms:play-services-ads-identifier.
> Could not list versions using M2 pattern 'https://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-ads-identifier/'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-ads-identifier/'.
> org.apache.http.client.ClientProtocolException (no error message)
> Failed to list versions for com.google.android.gms:play-services-ads-identifier.
> Could not list versions using M2 pattern 'https://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-ads-identifier/'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-ads-identifier/'.
> org.apache.http.client.ClientProtocolException (no error message)
> 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.
> Could not list versions using M2 pattern 'https://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-basement/'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-basement/'.
> org.apache.http.client.ClientProtocolException (no error message)
> Failed to list versions for com.google.android.gms:play-services-basement.
> Could not list versions using M2 pattern 'https://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-basement/'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-basement/'.
> org.apache.http.client.ClientProtocolException (no error message)
> 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.
> Could not list versions using M2 pattern 'https://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/'.
> org.apache.http.client.ClientProtocolException (no error message)
> Failed to list versions for com.google.android.gms:play-services-tasks.
> Could not list versions using M2 pattern 'https://jcenter.bintray.com/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/'.
> Could not GET 'https://jcenter.bintray.com/com/google/android/gms/play-services-tasks/'.
> org.apache.http.client.ClientProtocolException (no error message)
* 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
你知道這是什么原因嗎?我嘗試了以下方法,但沒有解決問題:
- Re-installingnpm包在卸載后+重新初始化平臺和插件
- 將gradle從7.2更新到7.4.2
- 刪除OneSignal插件
經過hours-long次試錯之后,我設法解決了這個問題,簡而言之,我做了以下幾點:
下面是上面的in-depthstep-by-step:
npm install --force
,以確保所有內容都能專心地傳遞,但現在我將npm從版本8全局降級為6,因為項目的package-lock.json是使用舊版本的npm生成的,因此將lockFileVersion
從1更改為2之間存在一些不兼容。這是可選的,但如果您的構建抱怨whiltelist插件,只需執行以下操作:
1.