How can I enable multiDex for SDK less than 21.
This page shows how to do it, but it says for API less 21.
If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:
public class MyApplication extends MultiDexApplication { ... }
So, in Flutter, my application by default overrides io.flutter.app.FlutterApplication and I should make changes in my FlutterApplication class but I couldn't open this file for editing because it is decompiled version. Can anyone help me? It is an issue on Github
Actually I need to create my own java class say MyApplication.java like this.
public class MyApplication extends FlutterApplication {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
After this in AndroidManifest.xml file, change
<application
android:name="io.flutter.app.FlutterApplication" .../>
to
<application
android:name=".MyApplication" .../>
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.
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 have added a module within my project and created an Application class which was added to the module's manifest.
public class App extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
#Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());;
}
}
Manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mymodule">
<application
android:allowBackup="true"
android:label="#string/app_name"
android:name="com.example.mymodule.App">
</application>
</manifest>
The problem is that I get no suggestions when trying to set the name of my application class within the Manifest. Any ideas why?
EDIT: I already have an Application class in my app module. The reason why I'm doing this is because I want to add a library in that module. How can I achieve this?
You need to type . (dot) and then you will get the suggestion. Like below
android:name=".App"
If you application class is within any package then the name will be
.[package name].[Application class]. If it is outside the any package the just the Application name.If still the problem exist then restart the studio sync,rebuild and clean it and check it once again.Hope this will help you.
I searched a lot about ACRA. Since after the code transferred from code.google.com to Github. All the answer's in SO has bad link's. All the example code's are not so useful as google docs has been deprecated for using it.
So please guide me how the new system woks and how to use it.
First, add ACRA to your project:
Maven
<dependency>
<groupId>ch.acra</groupId>
<artifactId>acra</artifactId>
<version>4.9.2</version>
<type>aar</type>
</dependency>
Gradle
compile 'ch.acra:acra:4.9.2'
Now, you need a java class that extends Application. This is also defined in the manifest so no initialisation of the class is needed!
#ReportsCrashes(
formUri = "http://example.com/reportpath"
)
public class MyApplication extends Application {
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ACRA.init(this);
}
}
In your manifest:
<application android:icon="#drawable/icon" android:label="#string/app_name"
IMPORTANT! ---> android:name="MyApplication" >
You need these permissions: (read logs is not necessary if you do not need to read the logcat)
<uses-permission android:name="android.permission.INTERNET"/>
That is everything you need java-wise. From here it splits in two. If your site supports CouchDB:
Install Acralyzer: https://github.com/ACRA/acralyzer
If your server doesn't have CouchDB, try one of these: https://github.com/ACRA/acra/wiki/Backends
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.