When i extends my activity class by AppCompatActivity it gave me Cannot resolve symbole AppCompatActivity.
I used the imports in my gradle but it does not works...
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.android.support:appcompat-v7:21.0.0'
Activity class
import android.support.v7.app.AppCompatActivity;//Cannot resolve symbole AppCompatActivity
public class myActivity extends AppCompatActivity{//Cannot resolve symbole AppCompatActivity
.
.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mymain);
intilaizs();
action();
}
.
.
My Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.me.menu_2"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.+'
// compile 'com.android.support:appcompat-v7:21.0.+'
// compile 'com.android.support:appcompat-v7:21.0.0'
compile project(':MenuLibrary')
compile files('libs/gson-2.2.4.jar', 'libs/gson-2.2.4-javadoc.jar', 'libs/gson-2.2.4-javadoc.jar')
}
Add following line in gradle file:
compile 'com.android.support:design:23.3.0'
I hope this will solve your problem.
You need to add compile 'com.android.support:support-v4:21.0.0'
Related
When i'm trying to do this:
...
public class LoginActivity extends AppCompatActivity {
#BindView(R.id.login_form) View loginForm;
...
loginForm is getting null. I tried to follow other answers and nothing worked (this for example). I also did exactly what it said in the butterKnife configuration page and it didn't work. What am I doing wrong?
module gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "name"
minSdkVersion 22
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 {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Project gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
Probably, you forget to put this line:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_activity);
ButterKnife.bind(this);
...
}
In onCreate you have to call
ButterKnife.Bind(this)
before you use the views
Also add mavenCentral() to repositories in gradle
repositories {
jcenter()
mavenCentral()
}
I need to remove ACRA for removing any vulnerabilities.
I had removed all imports/compiles in app.gradle and MyApplication.java. However, when I tried to build the project, the IDE gives below error:
error: cannot find symbol class RequiresApi
These are my app.gradle and MyApplication.java
app.gradle (I could not build after I removed compile 'ch.acra:acra:4.9.2' in dependencies)
buildscript {
(omitted)
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "******"
minSdkVersion 17
targetSdkVersion 22
versionCode 6
versionName "1.0.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'RestrictedApi'
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.journeyapps:zxing-android-embedded:3.0.1#aar'
compile 'com.google.zxing:core:3.2.0'
compile 'com.jakewharton:butterknife:8.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'net.zetetic:android-database-sqlcipher:3.5.7#aar'
compile 'com.google.code.gson:gson:2.8.2'
//compile 'ch.acra:acra:4.9.2' <- REMOVED ACRA
compile "io.reactivex.rxjava2:rxjava:2.1.9"
compile "io.reactivex.rxjava2:rxandroid:2.0.2"
}
MyApplication.java
package ******;
import android.app.Application;
public class MyApplication extends Application {
private static MyApplication myApplication;
public static MyApplication getInstance() {
return myApplication;
}
public void onCreate() {
super.onCreate();
myApplication = this;
}
}
I had also tried cleaning my project and rebuild, but did not work. When I put ACRA back, the project builds as usual. Is it the problem of IDE?
#RequiresApi is part of com.android.support:support-annotations. You have to add that as a dependency
e.g.
dependencies {
com.android.support:support-annotations:27.1.1
}
My purpose is to load the picture with glide.when the android project is compiled, there will be a mistake like this:
Program type already present: com.bumptech.glide.BitmapOptions Message{kind=ERROR, text=Program type already present: com.bumptech.glide.BitmapOptions, sources=[Unknown source file], toolname=Optional.of(D8)}
This problem bothers me for a long time,thanks for your answer
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.usercenter"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
}
Mainactivity.java:
public class MainActivity extends AppCompatActivity {
private ImageView blurImageView;
private ImageView avatarImageView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//
setContentView(R.layout.activity_main);//
blurImageView = (ImageView) findViewById(R.id.iv_blur);//
avatarImageView = (ImageView) findViewById(R.id.iv_avatar);//
Glide.with(this).load(R.drawable.head)
.bitmapTransform(new BlurTransformation(this, 25), new CenterCrop(this))
.into(blurImageView);
Glide.with(this).load(R.drawable.head)
.bitmapTransform(new CropCircleTransformation(this))
.into(avatarImageView);
}
}
Who can help me,please?
Remove compile 'com.github.bumptech.glide:glide:3.7.0'
Use latest version
dependencies {
implementation 'jp.wasabeef:glide-transformations:3.3.0'
}
Than Clear- Re-Build - Run your project
When i'm trying to do this:
...
public class LoginActivity extends AppCompatActivity {
#BindView(R.id.login_form) View loginForm;
...
loginForm is getting null. I tried to follow other answers and nothing worked (this for example). I also did exactly what it said in the butterKnife configuration page and it didn't work. What am I doing wrong?
module gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "name"
minSdkVersion 22
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 {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Project gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
Probably, you forget to put this line:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_activity);
ButterKnife.bind(this);
...
}
In onCreate you have to call
ButterKnife.Bind(this)
before you use the views
Also add mavenCentral() to repositories in gradle
repositories {
jcenter()
mavenCentral()
}
I am developing android app backend with amazon cognito and lambda.
My Code:
package digits.digitsapp;
import com.amazonaws.mobileconnectors.lambdainvoker.LambdaFunction;
public interface MyInterface {
#LambdaFunction
String digitsLogin(PhoneInfo phoneInfo);
#LambdaFunction(functionName = "digitsLogin")
void noDigitsLogin(PhoneInfo phoneInfo);
}
app(build.gradle) :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.testing"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-cognito:2.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.amazonaws:aws-android-sdk-lambda:2.2.+'
}
My problem is Error:(39, 13) Failed to resolve: com.amazonaws:aws-android-sdk-lambda:2.2.+
when i add lambda sdk then i sync gradle then error comes.
please tell me what to do