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

OutputFile is deprecated in android/app/build.gradle #35004

Closed
oluwaloju opened this issue Oct 17, 2022 · 1 comment
Closed

OutputFile is deprecated in android/app/build.gradle #35004

oluwaloju opened this issue Oct 17, 2022 · 1 comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer

Comments

@oluwaloju
Copy link

oluwaloju commented Oct 17, 2022

Description

Trying to generate an apk file but at the app/build.gradle level, the outputFile is deprecated
import com.android.build.OutputFile //outputFile deprecated

When i run ./gradlew bundlerelease, it throws off the error:

Execution failed for task ':app:mergeReleaseResources'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Could not resolve de.undercouch:gradle-download-task:5.1.0.
     Required by:
         project :app
      > The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.Buil
dTypeAttr' with value 'release', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.1', attribute 'org.jetbrains.kotlin.platform.type' wit
h value 'androidJvm'. However we cannot choose between the following variants of de.undercouch:gradle-download-task:5.1.0:
          - javadocElements
          - shadowRuntimeElements
          - sourcesElements
        All of them match the consumer attributes:
          - Variant 'javadocElements' capability de.undercouch:gradle-download-task:5.1.0 declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '7.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
                  - Provides documentation but the consumer didn't ask for it
                  - Provides its dependencies declared externally but the consumer didn't ask for it
                  - Provides javadocs but the consumer didn't ask for it
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Provides release status but the consumer didn't ask for it
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'shadowRuntimeElements' capability de.undercouch:gradle-download-task:5.1.0 declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '7.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
                  - Provides a library but the consumer didn't ask for it
                  - Provides its dependencies repackaged (shadow jar) but the consumer didn't ask for it
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Provides its elements packaged as a jar but the consumer didn't ask for it
                  - Provides release status but the consumer didn't ask for it
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'sourcesElements' capability de.undercouch:gradle-download-task:5.1.0 declares a runtime of a component:
              - Unmatched attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '7.2.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'release')
                  - Provides documentation but the consumer didn't ask for it
                  - Provides its dependencies declared externally but the consumer didn't ask for it
                  - Provides sources but the consumer didn't ask for it
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Provides release status but the consumer didn't ask for it
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
   > Could not find com.android.tools.build:gradle:7.5.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
       - https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
     Required by:
         project :app

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

How can I get a workaround for generating the apk release?

Version

0.70.1

Output of npx react-native info

System:
OS: Windows 10 10.0.19044
CPU: (4) x64 Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
Memory: 2.20 GB / 7.92 GB
Binaries:
Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-212.5712.43.2112.8815526
Visual Studio: Not Found
Languages:
Java: 17.0.4.1 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 18.1.0 => 18.1.0
react-native: ^0.70.1 => 0.70.1
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
info React Native v0.70.3 is now available (your project is running on v0.70.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.70.3
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.70.1
info To upgrade, run "react-native upgrade".

Steps to reproduce

Clone the repo below
Cd android
Cd app
open build.gradle
Check line 5
cd..
run ./gradlew bundlerelease

Snack, code example, screenshot, or link to a repository

Link to repository
https://github.com/oluwaloju/React-native-issue-deprecated-OutputFile-

@cortinico
Copy link
Contributor

Could not find com.android.tools.build:gradle:7.5.1.

Thanks for sharing your reproducer.
The issue is at this line:
https://github.com/oluwaloju/React-native-issue-deprecated-OutputFile-/blob/5435c49a48b77fe004ae2f188122b5aad7956d05/android/build.gradle#L36

The version of com.android.tools.build:gradle to use is 7.3.0

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Triage 🔍 labels Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests

3 participants