I get the following error when trying to execute the following line of code.
import com.example.albert.helper.SessionManager;
Error:(15, 33) error: package com.example.albert.helper does not exist
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion '21.0.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.1'
}
Related
While loading my app throws this error, then displays the layout normally. How can I stop it from throwing this error? Happens on both android 8 and android 6.
https://pastebin.com/AyYkdeY0
build.gradle
apply plugin: 'ashcollauthlogin.darkzek.com'
android {
compileSdkVersion 28
defaultConfig {
applicationId "ashcollauthlogin.darkzek.com"
minSdkVersion 18
targetSdkVersion 28
versionCode 2
versionName "2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '27.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
api 'com.android.support:design:28.0.0-alpha3'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:customtabs:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.github.navasmdc:MaterialDesign:1.5#aar'
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support:support-v13:28.0.0-alpha3'
}
repositories {
jcenter()
}
SettingsActivity.java:43
setContentView(R.layout.activity_settings);
android {
compileSdkVersion 28
defaultConfig {
applicationId "ashcollauthlogin.darkzek.com"
minSdkVersion 18
targetSdkVersion 28
versionCode 2
versionName "2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
I was getting this error:
Error:Execution failed for task ':app:preDebugBuild'.
Android dependency 'com.android.support:appcompat-v7' has different version for the compile (25.3.1) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution
A quick search on google showed me that I should include in my app/build.gradle:
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "25.3.1"
}
}
Now I get a new error:
Could not get unknown property 'resolutionStrategy' for project ':app' of type org.gradle.api.Project.
here is my full app/build.gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
dexOptions {
preDexLibraries = false
}
defaultConfig {
applicationId "co.test.Test"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'libs'
maven { url "http://dl.bintray.com/chat-sdk/chat-sdk-android" }
google()
maven { url "https://jitpack.io" }
mavenLocal()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':library')
implementation 'co.chatsdk.chatsdk:chat-sdk-core:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-ui:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-firebase-adapter:4.0.8'
implementation 'co.chatsdk.chatsdk:chat-sdk-firebase-file-storage:4.0.8'
}
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "25.3.1"
}
}
apply plugin: 'com.google.gms.google-services'
my library/build.gradle:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation files('libs/aacdecoder-android-0.8.jar')
}
I updated my minSDKVersion from 19 to 21. When I try running my app it crashes now. I get "Java.lang.ClassNotFoundException: Didnt find class android.support.v4.widget.DrawerLayout" any idea how to fix this?
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.id"
minSdkVersion 21
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:19.1.0'
}
You have updated your sdk with project change : import android.support.v7.app.ActionBarDrawerToggle; remove import android.support.v4.app.ActionBarDrawerToggle;
I am new to Android and Android Studio so, I downloaded a project that I also need for my class then I got this error. I could not find my answer here, although there was a question like mine. Please help me to run this program that I downloaded from internet and solve this error, thank you.
These are my gradles:
apply plugin: 'com.android.application'
android {
compileSdkVersion 17
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.gettaxi"
minSdkVersion 8
targetSdkVersion 17
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
}
And:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.stackoverflow.answer"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
androidTestCompile 'junit:junit:4.12'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
}
I'm trying to use the aacdecoder library to listen an online radio in my app, the thing is that it doesn't compile, I have added the jar library and added to the build.gradle, this is my code
MultiPlayer aacMp3Player = new MultiPlayer();
aacMp3Player.playAsync( "http://cast.direcnode.com:11413/stream" );
And this is the error:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/Ger/Documents/sdk/build-tools/android-4.4W/dx --dex --num-threads=4 --output /Users/Ger/Desktop/Radio/app/build/intermediates/dex/debug /Users/Ger/Desktop/Radio/app/build/intermediates/classes/debug /Users/Ger/Desktop/Radio/app/build/intermediates/dependency-cache/debug /Users/Ger/Desktop/Radio/app/build/intermediates/pre-dexed/debug/aacdecoder-android-0.8-470e8c408147266db0ce9215156fc542209cf849.jar
Error Code:
1
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "ger.radio"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile files('lib/aacdecoder-android-0.8.jar')
compile fileTree(dir: 'lib', include: ['*.jar'])
}
task copyNativeLibs(type: Copy) {
from(new File('libs')) { include '**' }
into new File(buildDir, 'native-libs')
}