I don't know what happened in the build please help me to find the issue.
I'm doing upgrade my react-native app from 0.64.2 to 0.72.1
What went wrong:
A problem occurred evaluating project ':react-native-restart'.
No signature of method: build_afxi0qx2ay1lg1ud0qnu4nfni.android() is applicable for argument types: (build_afxi0qx2ay1lg1ud0qnu4nfni$_run_closure1) values: [build_afxi0qx2ay1lg1ud0qnu4nfni$_run_closure1#1fae07c5]
where
def safeExtGet(name) {
rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties[name]
}
android {
namespace 'co m.reactnativerestart'
compileSdkVersion safeExtGet('compileSdkVersion')
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion')
targetSdkVersion safeExtGet('targetSdkVersion')
versionCode 1
versionName "1.0"
}
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
googlePlayServicesAuthVersion = "16.0.1"
firebaseIidVersion = "18.0.0"
kotlin_version = '1.6.10' // <- add this line
}
I'm trying to solve the issue but it not resolved please guide me for the solution
Related
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 31
ndkVersion = "20.1.5948944"
}
before
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
}
Also tried with in build.gradle
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "20.1.5948944"
}
Using android studio to generate .apk or .aab after the above changes .apk not getting installed in mobile. Help here. Build tools api installed in android studio
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true">
I only updated targetSdkVersion from 29 to 31 and adding android:exported="true" in androidManifest.xml resolved my issue
CHECK Failure [INSTALL_FAILED_USER_RESTRICTED: Invalid apk] in android
build.gradle
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 24
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
How to solve "Task :app:checkDebugAarMetadata FAILED" this React native error
Error
Error2
enter image description here
I got the following error while upload my app to google:
Your app currently targets API level 30 and must target at least API level 31 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 31.
Here is my android/build.gradle:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
...
}
How can I upgrade app target API to level 31?
I recently had this warning in my google console.
To solve it, I simply updated the targetSdkVersion from 30 to 31 in android/app/build.gradle file, which gives the following code (I also had to make sure the compileSdkVersion was set to 31):
android {
compileSdkVersion 31 // You can use
//...
defaultConfig {
targetSdkVersion 31
// ...
}
And I had to modify the buildscript in the android/app file as below:
buildscript {
ext {
buildToolsVersion = '30.0.2'
minSdkVersion = 21
compileSdkVersion = 31 // You can use ``rootProject.ext.compileSdkVersion`` instead
targetSdkVersion = // You can use ``rootProject.ext.targetSdkVersion`` instead
ndkVersion = '21.4.7075529'
playServicesVersion = '17.0.0' // or find latest version
androidMapsUtilsVersion = '2.3.0'
}
// ...
}
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "20.1.5948944"
}
...
}
<activity
android:name=".MainActivity"
android:exported="true" ... >
Add android:exported="true" or android:exported="false" in AndroidManifest.xml
file.
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
ndkVersion = "20.1.5948944"
}
...
}
change compileSdkVersion = 31 and compileSdkVersion = 31 in android/gradle/build.gradle [REACT NATIVE APPS]
I also got the same error when I deploy my application on the Play Store
so simply update the targetSdkVersion = 30 to targetSdkVersion = 31 in Your_project/android/build.gradle
targetSdkVersion = 31
and then run
cd android
./gradlew clean
I try to import project
i get this error when import project in android studio 3.5.3
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
and this error
This version of Android Studio cannot open this project, please retry with Android Studio 3.6 or newer
import org.jetbrains.kotlin.config.KotlinCompilerVersion
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
}
// https://stackoverflow.com/a/52441962
fun String.runCommand(
workingDir: File = File("."),
timeoutAmount: Long = 60,
timeoutUnit: TimeUnit = TimeUnit.SECONDS
): String? = try {
ProcessBuilder("\\s".toRegex().split(this))
.directory(workingDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start().apply { waitFor(timeoutAmount, timeoutUnit) }
.inputStream.bufferedReader().readText()
} catch (e: java.io.IOException) {
e.printStackTrace()
null
}
android {
compileSdkVersion(29)
buildToolsVersion("29.0.2")
viewBinding.isEnabled = true
val gitVersion = listOf(
"git rev-parse --abbrev-ref HEAD",
"git rev-list HEAD --count",
"git rev-parse --short HEAD"
).joinToString("-") { it.runCommand()?.trim() ?: "" } +
(if (("git status -s".runCommand() ?: "").isBlank()) "" else "-dirty")
defaultConfig {
applicationId = "com.test.cale"
minSdkVersion(15)
targetSdkVersion(29)
versionCode = 621
versionName = "6.2.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
resConfigs("en", "fa", "ckb", "ar", "ur", "ps", "glk", "azb", "ja")
setProperty("archivesBaseName", "PersianCalendar-$versionName-$gitVersion")
}
signingConfigs {
create("nightly") {
storeFile = rootProject.file("nightly.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
}
buildTypes {
create("nightly") {
signingConfig = signingConfigs.getByName("nightly")
versionNameSuffix = "-${defaultConfig.versionName}-$gitVersion-nightly"
applicationIdSuffix = ".nightly"
isMinifyEnabled = true
isShrinkResources = true
}
getByName("debug") {
versionNameSuffix = "-${defaultConfig.versionName}-$gitVersion"
applicationIdSuffix = ".debug"
}
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
// Maybe proguard-android-optimize.txt in future
// setProguardFiles(listOf(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"))
}
}
}
dependencies {
implementation(project(":equinox"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${KotlinCompilerVersion.VERSION}")
implementation("androidx.appcompat:appcompat:1.1.0")
implementation("androidx.preference:preference-ktx:1.1.0")
implementation("androidx.recyclerview:recyclerview:1.1.0")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.viewpager2:viewpager2:1.0.0")
implementation("com.google.android.material:material:1.1.0-rc02")
implementation("com.google.android:flexbox:1.1.0")
implementation("com.google.android.apps.dashclock:dashclock-api:2.0.0")
val navVersion = "2.1.0"
implementation("androidx.navigation:navigation-fragment-ktx:$navVersion")
implementation("androidx.navigation:navigation-ui-ktx:$navVersion")
implementation("androidx.core:core-ktx:1.1.0")
implementation("androidx.fragment:fragment-ktx:1.1.0")
implementation("androidx.activity:activity-ktx:1.0.0")
implementation("androidx.browser:browser:1.0.0")
implementation("androidx.work:work-runtime-ktx:2.2.0")
// debugImplementation("com.squareup.leakcanary:leakcanary-android:2.0-alpha-2")
// debugImplementation("com.github.pedrovgs:lynx:1.1.0")
testImplementation("junit:junit:4.12")
androidTestImplementation("androidx.test:runner:1.2.0")
androidTestImplementation("androidx.test:rules:1.2.0")
androidTestImplementation("androidx.test.espresso:espresso-contrib:3.2.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0")
}
please resolve the problem
Top-level Project Gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.6.0-rc01")
classpath(kotlin("gradle-plugin", version = "1.3.61"))
}
}
allprojects {
repositories {
google()
jcenter()
maven("https://jitpack.io")
}
}
task("clean") {
delete(rootProject.buildDir)
}
In general such a problem trying to add ViewPagerIndicator the project.
Gradle: Execution failed for task ':SherlockTest:dexDebug'.
> Running D:\Programs\AS\sdk\build-tools\android-4.2.2\dx.bat failed. See output
depending:
SherlockTestProject
settings.gradle
include ':SherlockTest'
include ':libraries:ViewPagerIndicator'
include ':libraries:ActionBarSherlock'
SherlockTest
build.grandle
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile project(':libraries:ActionBarSherlock')
compile project(':libraries:ViewPagerIndicator')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
libraries\ActionBarSherlock
build.grandle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/android-support-v13.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
libraries\ViewPagerIndicator
build.grandle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/android-support-v13.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
Since viewpagerindicator uses Maven, we should be able to include it like any maven project. Also, on maven, they have a tab for gradle projects. Link to project on maven page
I am starting to write an app using this as well, so we will see how it goes.
In your build.gradle,
dependencies{
...
compile 'com.viewpagerindicator:parent:2.4.1'
}