Reputation: 138
It's 3 days, 8h a day that I'm trying everything to make this stuff work but without any success.
I keep getting "AppCompatActivity not found". I don't know why. Any idea?
That's the code:
public abstract class DroidActivity extends AppCompatActivity
And that's the gradle file:
apply plugin: "com.android.library"
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':gsd_droid_common:External:ErlangOTP')
compile project(':gsd_droid_common:External:datetimepicker')
compile 'de.greenrobot:eventbus:2.4.0'
}
Upvotes: 0
Views: 694
Reputation: 1478
I found the solution! Create a new project with blank Activity, compare the wrong gradle and the gradle of new project, change the wrong to the new one of these 2 lines, something like:
compileSdkVersion 27
implementation 'com.android.support:appcompat-v7:27.1.1'
AppCompat version seems have to set to local compileSdkVersion !
Upvotes: 0
Reputation: 138
Actually everything worked just fined.
The problem was this. I only added
import android.support.v7.app.AppCompatActivity
At the beginning (I wanted to do it automatically with alt+enter but it wasn't possible) and fixed every compileSdkVersion from 22 to 23 of every module. Now it works just fine.
Upvotes: 1
Reputation: 711
You have to use grade - "compile 'com.android.support:appcompat-v7:22.2.1'" OR new latest version also and import file is --import android.support.v7.app.AppCompatActivity; Then u will get AppCompatActivity. Its working fine here..
Upvotes: 1
Reputation: 75778
You should use
compile 'com.android.support:appcompat-v7:23.1.1'
Finally
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':gsd_droid_common:External:ErlangOTP')
compile project(':gsd_droid_common:External:datetimepicker')
compile 'de.greenrobot:eventbus:2.4.0'
}
Then Clean-Rebuild-Restart-Sync your Project
.Hope it will helps .
Upvotes: 2