Problems compiling RenderScript - android

I've followed this tutorial:
https://futurestud.io/blog/how-to-blur-images-efficiently-with-androids-renderscript/
However, wherever the rs variable is mentioned, I get the following error:
Wrong 1st argument type. Found: 'android.support.v8.renderscript.RenderScript', required: 'android.renderscript.RenderScript'
This is my build.gradle:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.test.app"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
}
What am I doing wrong?

If you are importing:
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
Replaces those lines only by:
android.support.v8.renderscript.*
Good luck! (:

Yeah, you are mixing and matching "android.renderscript" and "android.support.v8.renderscript", as mentioned by #user5195185.
Also, try use Build-Tools 23.0.3 which includes several fixes for the support lib:
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.test.app"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
}

Related

where could i find flutter SDK Min and mix in VS Code

where should i find minSdkVersion from 16 to 21
android/app/build.gradle
it will look like this
defaultConfig {*
applicationId "***"
minSdkVersion 22
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName*
}

minSdkVersion is newer than the device API Level error while installing app

I am installing Android app with target sdk version android S in Android phone with Api level 30. My default config settings for app is like
compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 21
targetSdkVersion "S"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
But when I install the apk in Emulator with Api Level 30 I am getting error as
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_OLDER_SDK
The application's minSdkVersion is newer than the device API level.
How to resolve this ? Which things need to be modified to make it working ?
targetSdkVersion "S"
Using a prelimary version the minSdkVersion becomes S too automatically.
Changing to this version worked
compileSdkVersion 'android-S'
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Gradle related error

I have recently started using the android studio. Just after installing and downloading all the requisite files, I am welcomed by this error,"Failed to find the target with the hash string 'API 27'....", whereas I already have both API 27 and 28 installed (although 28 shows up to be partly installed).
I am completely new to this software.
Tools
SDK
error
you should use like below in gradle
{
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "xxxxxxxxx"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
}
don't write like compileSdkVersion 'API 27' its compileSdkVersion 27 only

Could not resolve com.android.support:design:27.0.3

I can't build a project with Android 27 as target SDK and 27.0.3 as buildToolsVersion.
My Android studio version is 3.0.1 and I also have google() in my repositories in project's buid.gradle.
I get this error:
> Could not resolve com.android.support:design:27.0.3.
> Failed to download SHA1 for resource 'https://maven.google.com/com/android/support/design/27.0.3/design-27.0.3.pom'.
> For input string: "<!"
Because of there isn't 27.0.3, you can use 27.0.1,27.0.2,27.1.0 instead. You can check the valid revision on here.
As per now use 27.0.2
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.example.packagename"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
implementation 'com.android.support:design:'27.0.2'
Try this code:
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
aaptOptions {
cruncherEnabled = false
}
defaultConfig {
applicationId "com.rokolabs.app.rokostickers"
minSdkVersion 19 // use 19 only use for transition(21)
targetSdkVersion 23
versionCode 117
versionName "0.1.30"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
}
}

Method for arguments with gradle in android studio

Syncing the project files with gradle files in android studio is resulting in the following error
Error:(14, 0) Could not find method applicationId() for arguments [com.amazon.mysampleapp] on project ':app' of type org.gradle.api.Project.
where the gradle file reads
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
applicationId "com.amazon.mysampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
What is happening here? Removing applicationID moves the error to minSdkVersion
The applicationId doesn't go inside the android block, but instead your buildConfig block:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "19.1"
defaultConfig {
applicationId "com.example.my.app"
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}
Pulled that from this page about applicationId: http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename

Categories

Resources