What's the solution for 65k ? I tried almost all the post but still not able to . Working on Android Studio but it is not letting me enable multidex option . Anyone having idea about it?
Any idea how to integrate with eclipse?
For Android Studio and Gradle the answer is here:
https://developer.android.com/tools/building/multidex.html#mdex-gradle
In Eclipse import the MultiDex library project from this location:
[android-sdk]\extras\android\support\multidex\library
Next you have three options:
Option 1
In your AndroidManifest.xml file update your <application> element like so:
<application
name="android.support.multidex.MultiDexApplication">
...
</application>
Option 2
If you use custom Application class make sure you extend MultiDexApplication.
MyApplication.java
public class MyApplication extends MultiDexApplication {
...
}
AndroidManifest.xml
<application
name=".MyApplication">
...
</application>
Option 3
If your application class cannot extend MultiDexApplication for some reason override the following method:
MyApplication.java
public class MyApplication extends Application {
...
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
AndroidManifest.xml
<application
name=".MyApplication">
...
</application>
Source: https://developer.android.com/reference/android/support/multidex/MultiDexApplication.html
Warning: Eclipse build tools do not support multidex. Look here for further info:
Android multidex support library using eclipse
I did this tut and worked http://android-developers.blogspot.com.es/2011/07/custom-class-loading-in-dalvik.html
I have now rhino.jar in a dex file in my asset folder
This problem is solved with Android studio 1.0 and above. We need to set multidexEnabled parameter to true.
That's all we need to implement. So, if anyone what to solve this problem you need to go with android studio.
Related
Branch wants me to use the "android:name" in the manifests file, but I already use it for multidex. So, how to overcome this conflict?
<application
...
//android:name="io.branch.referral.BranchApp"
android:name="android.support.multidex.MultiDexApplication"
...
</application>
This is the entire code of BranchApp:
public class BranchApp extends Application {
#Override
public void onCreate() {
super.onCreate();
if (BranchUtil.isTestModeEnabled(this) == false) {
Branch.getInstance(this);
} else {
Branch.getTestInstance(this);
}
}
}
Make a custom Application class that extends MultiDexApplication, and use this override for the onCreate and you're good.
The Branch SDK has its own custom activity and application class. Other plugins that use their own custom activity and application classes can cause "conflicts" between these classes. To resolve these conflicts:
Create an empty android library
Add the Branch plugin along with the other plugins into your project
Create a custom Activity and Application class that will contain the custom logic for all your plugins
Build your library
Add your library into Unity project
Change android:name to name of your custom Application class in the application tag of your Manifest
Change android:name to name of your custom Activity class in the activity tag of your Manifest
Some Plugins expand the default AppController the same was as Branch does like Cardboard SDK plugin. To resolve conflicts:
Merge all custom AppControllers in one.
Comment code in other AppControllers (or delete other AppControllers).
Here are some Code Samples for resolving conflicts with other 3rd party plugins
If you still face any issues, please write to integrations#branch.io with the details.
How to solve this error I'm getting in Android Studio:
Error: Cannot fit requested classes in a single dex file (# methods: 67593 > 65536)
cant build my project now
Do this 4 step
1: Add this library in dependencies of the app build.gradle :
implementation 'com.android.support:multidex:1.0.3'
2: Add in the defaultConfig of the app build.gradle :
defaultConfig {
//other configs
multiDexEnabled true //add this line
}
3: Create new Java class like this :
public class ApplicationClass extends MultiDexApplication {
#Override
public void onCreate() {
super.onCreate();
}
}
4: Add this to your manifest (in application tag):
<application
android:name=".ApplicationClass"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name">
Same situation happened in my Visual Studio 2019 Xamarin project, and the way to solve this problem is just like what mentioned in the link:
Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536
multiDexEnabled true
By checking the Enable multiDex checkbox in the option page of the ***.Droid project solves the problem.
Before you take any decision, as said in Google documentation :
Before configuring your app to enable use of 64K or more method
references, you should take steps to reduce the total number of
references called by your app code, including methods defined by your
app code or included libraries.
So try to remove useless importation in your app gradle and do a nice clean project or do multidex
Source : https://developer.android.com/studio/build/multidex
I am in a world of trouble. In a position of inheriting an Android App in Java with a team of C# .Net developers.
I am getting an (Access Denied) error to the projects root app folder C:\Users\user.name\Development\theproject\app
The project builds, cleans and rebuilds no problem but on debug or run, it fails at this step app:transformDexWithInstantRunDependenciesApkForDebug.
In the research so far I am getting lost in setting application permissions in the manifest.xml file but this feels more like a local machine folder permission issue more than an application issue.
I have tried running Android Studio in Adminstrator mode and both it and the emulator appear to be running under my username. I have administration priviliges to my machine.
Any help greatly appreciated. I had never heard of gradle until yesterday.
This is done as you have used multilibrary and the methods exceed the limits.
Modify your build.gradle:
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
include this in application class :
public class YouApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Add this class name to the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
I used to receive DexIndexOverflowException a couple of days ago and what I did is :
a) adding multiDexEnabled true to defaultConfig in my build.gradle file.
b) adding compile 'com.android.support:multidex:1.0.1' in the dependencies section.
and after that everything is running OK again.
Today I was reading multidex user guide in d.android.com site ( link here ) and it says that I should also override MultiDexApplication class (since I already extend from Application ).
My question is : since I'm not extending MultiDexApplication how is it possible, by doing only the two things I mentioned above, not to receive the Exception I was receiving before ? And what should I do now ? Should I try and extend MultiDexApplication even if now everything is OK?
Your code must be near in the number limit of methods, i recomend make the total implementation. Otherwise you can review your dependencies and remove those you are not using and use ProGuard. Good pratice is helpfull, like prefer use methods private when possible.
You have some possibilities to use MultiDex.
Minimal MultiDex capable application. To use the legacy multidex
library there is 3 possibility:
Declare this class as the application in your AndroidManifest.xml.
Have your Application extends this class.
Have your Application override attachBaseContext starting with protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this);
The last one should fit for you.
I'm following the steps from the RoboBlender Wiki to use annotations database but I keep getting java.lang.IllegalStateException: Unable to use annotation database(s) because it cannot find AnnotationDatabaseImpl
I am using Android Studio and Gradle. The project consists of multiple modules.
app
moduleA
moduleB
moduleC
Here is what I added to my build scripts:
app/build.gradle:
dependencies {
provided 'org.roboguice:roboblender:3.0.1'
provided 'org.roboguice:roboblender:3.0.1'
}
project.tasks.withType(JavaCompile) { task ->
options.compilerArgs << "-AguiceAnnotationDatabasePackageName=com.sample.myapp"
}
module[x]/build.gradle:
project.tasks.withType(JavaCompile) { task ->
options.compilerArgs << "-AguiceAnnotationDatabasePackageName=com.sample.module[x]"
}
On the Application Object:
RoboGuice.setUseAnnotationDatabases(true);
RoboGuice.getOrCreateBaseApplicationInjector(this, RoboGuice.DEFAULT_STAGE,
RoboGuice.newDefaultRoboModule(this), new MyModule());
RoboGuice.injectMembers(this, this);
Am I missing something? I found some similar questions but they weren't very useful.
Update:
I forgot to add it on the first time but yes I am including the manifest meta.
<meta-data android:name="roboguice.modules" android:value="your.package.MyModule"/>
<meta-data android:name="roboguice.annotations.packages" android:value="com.sample.myapp,com.sample.modulex,com.sample.moduley"/>
Update 2:
I finally found the problem. Proguard was deleting the class. Fixed by adding:
-keep public class * extends com.google.inject.AnnotationDatabase
Did you list your module and your annotation databases in your AndroidManifest.xml?
<meta-data android:name="roboguice.modules" android:value="your.package.MyModule"/>
<meta-data android:name="roboguice.annotations.packages" android:value="com.sample.myapp,com.sample.modulex,com.sample.moduley"/>
After some hours I found the problem. It was proguard. Adding the following line fixed the issue.
-keep public class * extends com.google.inject.AnnotationDatabase
You can check that the classes are being generated by running in the project folder:
find . | grep -i AnnotationDatabaseImpl