Due to 65K
error in my project I need it to migrate to Android Studio . While running
./gradlew assembleDebug
I am
I have been struggling with this problem for 2 days. And tried all options. Finally noticed that after updating my android studio, it was not showing me the compile errors like @v.d. wrote above. My problem was, In my build files, I was using compile(which should be replaced with implementation or api) and testcompile(which also replaced by testimplementation). Notice that I have changed in whole build files(android, app and others - in my case I also had folding-cell library)
for example instead of this
compile project(path: ':folding-cell')
write this
implementation project(path: ':folding-cell')
My Simple Answer is and only solution...
Please Check The layout files, which you added lastly there MUST be a error in the .xml file for sure.
We may simply copy and pasting .xml file from other project and something missing in the xml file..
Error in the .xml file would be some of the below....
After Placing all the available code in the respected folders do not forget to CLEAN The Project...
I had the same issue and I could solve it like this:
1) If your minSdkVersion
is set to 21 or a higher value, the only thing you need to do is to set multiDexEnabled
in your build.gradle
file at the module level, as shown below:
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
}
...
}
2) However, if your minSdkVersion is set to 20 or less, you should use the MultiDex compatibility library, as follows:
2.1) Modify the module-level build.gradle
file to enable MultiDex and add the MultiDex library as dependency, as shown below
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
...
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
2.2) According to the Application
class or not, do one of the following actions:
2.2.1) If you do not cancel the Application
class, modify your manifest file to set android: name
in the <application>
tag as shown below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
2.2.2) If you cancel the Application
class, you must change it to extend MultiDexApplication
(if possible) as shown below:
public class MyApplication extends MultiDexApplication { ... }
2.2.3) Also, if you override the Application
class and can not change the base class, alternatively you can override the attachBaseContext ()
method and invoke MultiDex.install (this)
to enable MultiDex:
public class MyApplication extends SomeOtherApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Please use this link, it was really useful for me!
Well in my case i was accessing an static array of a class by reference of that class, but as we know we can directly access static member via class name. So when I replaced reference with class name where I was accessing that array. It fixed this error.
Add multiDexEnabled in gradle (app level) like this:
defaultConfig {
...
...
multiDexEnabled true
}
I have disabled Instant Run feature from the preferences and the issue was solved.