ac4android
Well-Known Member
Hi.
On building the gradle to run the app, I am starting to log a lot of errors. After commenting out downstream Intent(someactivity, some.class), I was able to narrow it down to what seems to be caused by a 65k limitation. But I'm still getting the dalvik-error! The codes can only grow further.
How do I move forward?
UPDATE: the AVD complains about running out of space and the app might not load, but then the app does run !?!
Logcat
=====
E/Trace: error opening trace file: No such file or directory (2)
E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.zze.zzb
Updated my build.gradle with MultiDex
============================
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myproject.android101"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.google.android.gms
lay-services-plus:8.4.0'
compile 'com.google.android.gms
lay-services:8.4.0'
compile 'com.google.android.gms
lay-services-maps:8.4.0'
compile 'com.google.android.gms
lay-services-ads:8.4.0'
compile 'com.google.android.gms
lay-services-identity:8.4.0'
compile 'com.google.android.gms
lay-services-gcm:8.4.0'
compile 'com.google.android.gms
lay-services-analytics:8.4.0'
compile 'com.android.support:multidex:1.0.1'
}
Inserted MultiDex into my AndroidManifest
==============================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myproject.android101">
etc...
lots of XML
etc...
<application
android:allowBackup="true"
android:icon="@Mipmap/ic_launcher"
android:label="@String/app_name"
android:supportsRtl="true"
android:theme="@Style/AppTheme"
android:name="android.support.multidex.MultiDexApplication" >
Inserted into MainActivity.class
======================
On building the gradle to run the app, I am starting to log a lot of errors. After commenting out downstream Intent(someactivity, some.class), I was able to narrow it down to what seems to be caused by a 65k limitation. But I'm still getting the dalvik-error! The codes can only grow further.
How do I move forward?
UPDATE: the AVD complains about running out of space and the app might not load, but then the app does run !?!
Logcat
=====
E/Trace: error opening trace file: No such file or directory (2)
E/dalvikvm: Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.zze.zzb
Updated my build.gradle with MultiDex
============================
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.myproject.android101"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.google.android.gms
lay-services-plus:8.4.0'compile 'com.google.android.gms
lay-services:8.4.0'compile 'com.google.android.gms
lay-services-maps:8.4.0'compile 'com.google.android.gms
lay-services-ads:8.4.0'compile 'com.google.android.gms
lay-services-identity:8.4.0'compile 'com.google.android.gms
lay-services-gcm:8.4.0'compile 'com.google.android.gms
lay-services-analytics:8.4.0'compile 'com.android.support:multidex:1.0.1'
}
Inserted MultiDex into my AndroidManifest
==============================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myproject.android101">
etc...
lots of XML
etc...
<application
android:allowBackup="true"
android:icon="@Mipmap/ic_launcher"
android:label="@String/app_name"
android:supportsRtl="true"
android:theme="@Style/AppTheme"
android:name="android.support.multidex.MultiDexApplication" >
Inserted into MainActivity.class
======================
Code:
public class TopLevelActivity extends Activity {
[USER=1021285]@override[/USER]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_top_level);
// We need an OnItemClickListener for the array options in top level XML
AdapterView.OnItemClickListener itemClickListener = new AdapterView.OnItemClickListener(){
// we have to create the onItemClick method ourself
public void onItemClick(AdapterView<?> listView,
View v,
int position,
long id) {
if (position == 0) {
Intent intent = new Intent(TopLevelActivity.this, SomeActivity.class);
startActivity(intent);
}
}
};
// Instantiate a list view to display the list options using the layout in the XML file
ListView listView = (ListView) findViewById(R.id.list_options);
// ...then plug the listener into the list view
listView.setOnItemClickListener(itemClickListener);
}
// Use multidex to overcome the 65k limit, NB will only work with version# > 14
public void attachBaseContext(Context newBase) {
super.attachBaseContext(newBase);
MultiDex.install(this);
}
}
Last edited:
You really don't want to use it