error while importing stackblue into Android Studio project - android

I'm trying to import and add android stackblur into a android studio project, but it is missing the ScriptC_blur class.
I also added the following values to build.gradle for android gradle plugin v0.14.1. However, it doesn't resolve the issue
android {
compileSdkVersion 21
buildToolsVersion '21.1.0'
defaultConfig {
...
minSdkVersion 11
targetSdkVersion 21
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
}
...
dependencies {
...
compile files('libs/renderscript-v8.jar')
...
}
}
I also followed this thread, but I had no luck to get it to work. Any advice and suggestions will be greatly appreciated

Related

error: package android.support.multidex does not exist whem upgrading from minSdkVersion 16 to minSdkVersion 23

My app is not supporting Android 4.x and 5.x anymore, only Android 6.0 and higher. For that reason, in my app/build.gradle I changed minSdkVersion 16 to minSdkVersion 23. After doing that, I have started to get this error when I try to run the app:
error: package android.support.multidex does not exist
error: cannot find symbol variable MultiDex
In one of my .java files, I see the errors in the following lines:
import android.support.multidex.MultiDex;
MultiDex.install(this);
Should I simply not use MultiDex because Android 6.0 and higher do not need that anymore? This is considering that my app will not support Android 5.x and lower anymore. Thank you.
The solution to this problem is to add the following in Dependencies in build.gradle (:app):
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
If your minSdkVersion is set to 21 or higher, all you need to do is set multiDexEnabled to true in your module-level build.gradle file, as shown here:
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
}
...
}
https://developer.android.com/studio/build/multidex
I needed to change
import android.support.multidex.MultiDex
to
import androidx.multidex.MultiDex
to reference the "newer" MultiDex's location (version 1.0.3 in my case).
Try setting multiDexEnabled true in build.gradle(app)

attr/colorError not found error when using com.android.support:recyclerview-v7:26.0.0-beta2

I'm using Android Studio 3.0 Canary 4. I imported the recycler view library. Then it comes out the attr/colorError not found message.
This is app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.robyn.myapplication"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:26.0.0-beta2'
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
}
Whenever I add the two libraries implementation 'com.android.support:recyclerview-v7:26.0.0-beta2' and
implementation 'com.android.support:appcompat-v7:26.0.0-beta2', it comes out this error message:
I tried clean and rebuild, the error message is still there. I checked res/values/colors, the color values are there. Why I get this color error? If I want to use recycler view, what version of library should I import?
Change the following details it will work fine,
compileSdkVersion 26
buildToolsVersion "26.0.0-beta2"
Also upgrading compileSDKVersion and buildToolsVersion to 26 (it was 25) fixed the issue for me:
compileSdkVersion 26
buildToolsVersion '26.0.2'
...
dependencies {
...
compile 'com.android.support:appcompat-v7:26.0.2'
}
In general, make sure to keep all the versions consistent (compile, build, appcompat libraries).
This is to ensure compilation and stability on runtime (one can also see lint warning about the latter if lint finds differnet support library versions)
Revision 26.0.0 Beta 2
Please note that 26.0.0-beta2 is a pre-release version. Its API
surface is subject to change, and it does not necessarily include
features or bug fixes from the latest stable versions of Support
Library.
For your problem you can use "26.0.0-beta2" . It will be better if you use Stable Version .
pasting following code at Android/build.gradle bottom helped me:
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
}
}
}
}
I've seen the same error when my app is on appcompat-26 and tries to include an Android library which in turn uses appcompat-25.
My solution has so far been to keep the app on 25 as well.
I have no idea if it's supposed to be like this. Surely you must be able to publish a library that uses the support lib version X and have it run in apps using support lib version X+1.
I am using AS 3.0-beta7 so maybe it's resolved on stable 3.0 which was released a few days ago.
Just change the minSdk:
e.g.:
android {
compileSdkVersion 26
buildToolsVersion "26.0.0-beta2"
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
}
Hope this helps
I found this "attr/colorError" error occurred when I had created product flavours and had put the "legacy" after the "current" in my build.gradle (in "app" folder). When I put the "legacy" before the "current" (as shown below) then the error went away. Maybe the lower "versionCode" or "Sdk" versions need to appear first?
flavorDimensions "legacycurrent"
productFlavors {
legacy {
dimension "legacycurrent"
versionCode 98
minSdkVersion 9
targetSdkVersion 25
compileSdkVersion 25
}
current {
dimension "legacycurrent"
versionCode 99
minSdkVersion 14
targetSdkVersion 26
compileSdkVersion 26
}
}
FWW - For future searchers, I've added the code below to my root build.gradle to search down through dependencies and fix them to match my root project. There are probably caveats and reasons why this is a bad idea, but it consistently works for me.
subprojects {
afterEvaluate {subproject ->
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
this code in android/build.gradle fixed my error.
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 31
buildToolsVersion "30.0.2"
}
}
}
}

android : NoClassDefFoundError for android 4.4 and below

My app gives NoClassDefFoundError for versions of sdk 19 or below.
I had in my gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.idg.mail"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled = true
}
Now i tried to change it to
compileSdkVersion 19
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.idg.gatcamail"
minSdkVersion 19
targetSdkVersion 19
multiDexEnabled = true
}
i changed in app-> module settings - android - sdk as well.
With these changes i built the project but still it gives same error on my android 4.4 and it runs on higher versions.
The class is a class defined in the code where i handle network operations.
How can i do the debugging of this issue
I'm almost sure that it is multidex issue. If it's running properly on sdk 21 - it's multidex issue.
Here is official info: Multidex
If you're using custom implementation of Application class, it has to extend MultiDexApplication class. Also there is gradle flag required. If you're not using custom Application class, just add entry provided in your manifest - it's described in documentation.
Edit: Almost forgot - you've to add dependency, multidex is provided with this library: compile 'com.android.support:multidex:1.0.1'

Android Studio is giving multiple errors since API 22 updated

I am getting multiple errors in my project, previously it was working fine. I tried may things changing the target api changing dependencies, i dont know why it is not working. Please help me out.
Change your build.gradle file to this,
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.example.name"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
.......
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:6.5.87'
}
Now clean and rebuild the project.

Android compile project with target="android-19" failed

Masters,
Recently I am trying to build android project with gradle, and since there one API(#JavascriptInterface annotation) I need to use is only up to api level 17, so I changed my targetAPILevel to 19 in project properties. And it works well when I build the project from Eclipse(Right click on project and Run Android Application).
But when I tried to build the project by gradlew in terminal, it seems it never use target level 19 to build the project. Here is part of the build.gradle file as follow:
android {
// target = 'android-19'
compileSdkVersion 19
buildToolsVersion '19.0.1'
}
Can anyone help me what I did wrong in here, please? Thank you very much.
TargetSdkVersion and compileSdkVersion are different parameters.
In eclipse, you set the target in your Manifest, and set the api used to compile with right click -> properties -> Android Manu.
In your build.gradle you should use something like this:
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}

Categories

Resources