- Open your project
- Navigate to the first build.gradle file in your app structure
- Add “mavenCentral()” to your repositories
- Now add AppCompat library to you project and your app will compile and run successfully
Solved error with AppCompat 27
Have you added the AppCompat to your dependencies? show me the full build.gradle
apply plugin: ‘com.android.application’
android {
compileSdkVersion 27
buildToolsVersion “27.+”
defaultConfig {
applicationId "com.mycompany.myapp"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile ('android.arch.core:runtime:+')
{
}
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
dependencies {
compile ('android.arch.core:runtime:+')
{
force = true
}
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Force close sir ,
Im using android MM 6.0
show me your MainActivity.class and Style.xml files
Open Style.xml and then replace with this code.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
</style>
</resources>
I don’t know sir, I haven’t been able to use the appcompatactiviy. still forced to close
Why my app still force close?
Sorry, i have solve the problem
I’m having the same problem with the application forced to close.
The first (build.gradle):
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:1.+’
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
The first (build.gradle):
apply plugin: ‘com.android.application’
android {
compileSdkVersion 27
buildToolsVersion “27.+”
defaultConfig {
applicationId "br.com.weliton.layout"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile (‘android.arch.core:runtime:+’)
{
force = true
}
api ‘com.android.support:appcompat-v7:27.+’
compile fileTree(dir: ‘libs’, include: [’*.jar’])
}
The file(Style)
<?xml version="1.0" encoding="utf-8"?>
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
</style>
i still got FC when using support library 27, only working support v26…
any idea about my problem?
Process: com.mycompany.myapp
PID: 18020
Flags: 0x38a8be46
Package: com.mycompany.myapp v1 (1.0)
Foreground: Yes
Build: Xiaomi/rolex/rolex:7.1.2/N2G47H/V9.2.6.0.NCCMIEK:user/release-keys
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity}: java.lang.ClassNotFoundException: Didn’t find class “com.mycompany.myapp.MainActivity” on path: DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/com.mycompany.myapp-Pr7a6oe6C1tSA-lsqkNLpg==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.myapp-Pr7a6oe6C1tSA-lsqkNLpg==/lib/arm64, /system/lib64, /vendor/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2881)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6719)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:495)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.mycompany.myapp.MainActivity” on path: DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/com.mycompany.myapp-Pr7a6oe6C1tSA-lsqkNLpg==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.myapp-Pr7a6oe6C1tSA-lsqkNLpg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at android.app.Instrumentation.newActivity(Instrumentation.java:1216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2869)
… 11 more
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
… 15 more
Caused by: java.lang.ClassNotFoundException: android.support.v7.app.AppCompatActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
… 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/FragmentActivity;
… 18 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.FragmentActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
… 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/BaseFragmentActivityApi16;
… 18 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.BaseFragmentActivityApi16
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
… 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/BaseFragmentActivityApi14;
… 18 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.BaseFragmentActivityApi14
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
… 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/app/SupportActivity;
… 18 more
Caused by: java.lang.ClassNotFoundException: android.support.v4.app.SupportActivity
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
… 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/arch/lifecycle/LifecycleOwner;
… 18 more
Caused by: java.lang.ClassNotFoundException: Didn’t find class “android.arch.lifecycle.LifecycleOwner” on path: DexPathList[[zip file “/system/framework/org.apache.http.legacy.boot.jar”, zip file “/data/app/com.mycompany.myapp-Pr7a6oe6C1tSA-lsqkNLpg==/base.apk”],nativeLibraryDirectories=[/data/app/com.mycompany.myapp-Pr7a6oe6C1tSA-lsqkNLpg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
… 18 more
how to fix bro ?? i used the appcompat v27 and still FC!!
Are you an indonesian?
yes… im indonesian