gpt4 book ai didi

java - Android 应用程序启动缓慢,但启动缓慢后运行良好

转载 作者:行者123 更新时间:2023-11-30 08:49:20 26 4
gpt4 key购买 nike

我更新了我的 Android 应用的代码以包括:

  • 活跃的安卓
  • TargetsdkVersion 22(布局中包含一些 Material Design 元素)
  • MinSdkVersion 9(这也是我的早期版本)
  • Google Analytics v4,Google Play 服务的一部分

我的早期版本是在 Eclipse 中创建的,这次更新我使用的是 Android Studio。导入没有用,所以我在 Android studio 中重新创建了项目。对于主要部分,它似乎工作正常。

但是当应用程序第一次启动时,它很慢。在主屏幕显示之前,盯着白色屏幕大约需要 1.5 秒。之后,该应用程序运行良好且快速。

重新启动它,当将应用程序保存在内存中时,它会立即启动。如果您将应用程序从内存中取出,它还需要 1.5 秒(/2 秒)才能开始。

我在 Nexus 7 (2013) 和 FairPhone (Android 4.2.2) 上对其进行了测试。我不明白问题出在哪里,也许你可以帮助我。一个解决方案会很好,但即使指出原因也会有很大帮助。

App.java(扩展Application)相关代码:

@Override
public void onCreate() {
super.onCreate();
mContext = this;

Log.v("App","onCreate App - before GoogleAnalytics.getInstance(this)");

analytics = GoogleAnalytics.getInstance(this);
analytics.setLocalDispatchPeriod(1800); // every 30 minutes
tracker = analytics.newTracker("REMOVED CODE FOR STACKOVERLOW");
tracker.enableExceptionReporting(true);

// Since I do this 'by hand', enabling automatic will amount to double counting.
tracker.enableAutoActivityTracking(false);

Log.v("App", "onCreate App - after GA");


// Because it is initialized here, we don't need to put it as the application in Manifest
// This means we can use Google Analytics code referring to 'getApplication'.
ActiveAndroid.initialize(this);

Log.v("App", "onCreate App - after AA");

Gradle 文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

defaultConfig {
applicationId "com.juliushuijnk.tools.ideagrowr"
minSdkVersion 9
targetSdkVersion 22
versionCode 38
versionName "1.38"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'uk.co.ribot:easyadapter:1.4.0@aar'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
}

登录我的 Fairphone (android 4.2.2)

    07-19 14:18:24.517  18930-18930/com.juliushuijnk.tools.ideagrowr V/App﹕ onCreate App - before GoogleAnalytics.getInstance(this)
07-19 14:18:24.527 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Could not find method android.app.Notification$Builder.setLocalOnly, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
07-19 14:18:24.527 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ VFY: unable to resolve virtual method 245: Landroid/app/Notification$Builder;.setLocalOnly (Z)Landroid/app/Notification$Builder;
07-19 14:18:24.528 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ DexOpt: access denied from Lcom/google/android/gms/common/GooglePlayServicesUtil; to field Landroid/app/Notification;.extras
07-19 14:18:24.528 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ VFY: unable to resolve instance field 18
07-19 14:18:24.528 18930-18930/com.juliushuijnk.tools.ideagrowr E/dalvikvm﹕ Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
07-19 14:18:24.528 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ VFY: unable to resolve check-cast 25 (Landroid/app/AppOpsManager;) in Lcom/google/android/gms/common/GooglePlayServicesUtil;
07-19 14:18:24.530 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzh
07-19 14:18:24.530 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ VFY: unable to resolve virtual method 553: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
07-19 14:18:24.534 18930-18930/com.juliushuijnk.tools.ideagrowr I/GAv4﹕ Google Analytics 7.5.71 is starting up. To enable debug logging on a device run:
adb shell setprop log.tag.GAv4 DEBUG
adb logcat -s GAv4
07-19 14:18:24.538 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.MainActivity
07-19 14:18:24.547 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.AllIdeasActivity
07-19 14:18:24.548 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.AllNotesActivity
07-19 14:18:24.548 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.CreateIdeaActivity
07-19 14:18:24.548 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.CreateNoteActivity
07-19 14:18:24.549 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.DeleteIdeaActivity
07-19 14:18:24.549 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.OverviewActivity
07-19 14:18:24.549 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.InfoActivity
07-19 14:18:24.550 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.EditQsetActivity
07-19 14:18:24.550 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.LikeActivity
07-19 14:18:24.550 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.MigrateDatabaseActivity
07-19 14:18:24.550 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.SettingsActivity
07-19 14:18:24.551 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.UpdateCoreActivity
07-19 14:18:24.553 18930-18930/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ Bool xml configuration name not recognized: ga_reportUncaughtExceptions
07-19 14:18:24.573 18930-18930/com.juliushuijnk.tools.ideagrowr V/App﹕ onCreate App - after GA
07-19 14:18:24.636 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/ActivityCompat21$SharedElementCallbackImpl; (54)
07-19 14:18:24.636 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/ActivityCompat21$SharedElementCallbackImpl;' failed
07-19 14:18:24.666 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$1; (1697)
07-19 14:18:24.666 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$1;' failed
07-19 14:18:24.667 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$3; (1697)
07-19 14:18:24.667 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$3;' failed
07-19 14:18:24.687 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/media/TransportMediatorJellybeanMR2$1; interface 1775 'Landroid/view/ViewTreeObserver$OnWindowAttachListener;'
07-19 14:18:24.687 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/TransportMediatorJellybeanMR2$1;' failed
07-19 14:18:24.688 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/media/TransportMediatorJellybeanMR2$2; interface 1776 'Landroid/view/ViewTreeObserver$OnWindowFocusChangeListener;'
07-19 14:18:24.688 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/TransportMediatorJellybeanMR2$2;' failed
07-19 14:18:24.689 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/media/TransportMediatorJellybeanMR2; interface 197 'Landroid/media/RemoteControlClient$OnGetPlaybackPositionListener;'
07-19 14:18:24.689 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/TransportMediatorJellybeanMR2;' failed
07-19 14:18:24.690 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/media/VolumeProviderCompatApi21$1; (202)
07-19 14:18:24.690 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/VolumeProviderCompatApi21$1;' failed
07-19 14:18:24.705 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/media/session/MediaControllerCompatApi21$CallbackProxy; (203)
07-19 14:18:24.705 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/session/MediaControllerCompatApi21$CallbackProxy;' failed
07-19 14:18:24.708 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/media/session/MediaSessionCompatApi18$OnPlaybackPositionUpdateListener; interface 199 'Landroid/media/RemoteControlClient$OnPlaybackPositionUpdateListener;'
07-19 14:18:24.708 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/session/MediaSessionCompatApi18$OnPlaybackPositionUpdateListener;' failed
07-19 14:18:24.709 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/media/session/MediaSessionCompatApi19$OnMetadataUpdateListener; interface 198 'Landroid/media/RemoteControlClient$OnMetadataUpdateListener;'
07-19 14:18:24.709 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/session/MediaSessionCompatApi19$OnMetadataUpdateListener;' failed
07-19 14:18:24.816 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/media/session/MediaSessionCompatApi21$CallbackProxy; (207)
07-19 14:18:24.816 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/media/session/MediaSessionCompatApi21$CallbackProxy;' failed
07-19 14:18:24.823 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/print/PrintHelperKitkat$1; (264)
07-19 14:18:24.823 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/print/PrintHelperKitkat$1;' failed
07-19 14:18:24.824 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/print/PrintHelperKitkat$2; (264)
07-19 14:18:24.824 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/print/PrintHelperKitkat$2;' failed
07-19 14:18:24.847 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/view/ViewCompatLollipop$1; interface 1754 'Landroid/view/View$OnApplyWindowInsetsListener;'
07-19 14:18:24.847 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/view/ViewCompatLollipop$1;' failed
07-19 14:18:24.867 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Failed resolving Landroid/support/v4/widget/DrawerLayoutCompatApi21$InsetsListener; interface 1754 'Landroid/view/View$OnApplyWindowInsetsListener;'
07-19 14:18:24.867 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Landroid/support/v4/widget/DrawerLayoutCompatApi21$InsetsListener;' failed
07-19 14:18:24.904 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ method Landroid/support/v7/internal/widget/ListViewCompat;.lookForSelectablePosition incorrectly overrides package-private method with same name in Landroid/widget/ListView;
07-19 14:18:25.319 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Luk/co/ribot/easyadapter/BaseEasyRecyclerAdapter$RecyclerViewHolder; (1642)
07-19 14:18:25.319 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Luk/co/ribot/easyadapter/BaseEasyRecyclerAdapter$RecyclerViewHolder;' failed
07-19 14:18:25.320 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Luk/co/ribot/easyadapter/BaseEasyRecyclerAdapter; (1641)
07-19 14:18:25.320 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Luk/co/ribot/easyadapter/BaseEasyRecyclerAdapter;' failed
07-19 14:18:25.680 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Luk/co/ribot/easyadapter/BaseEasyRecyclerAdapter; (1641)
07-19 14:18:25.680 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Luk/co/ribot/easyadapter/BaseEasyRecyclerAdapter;' failed
07-19 14:18:25.680 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Unable to resolve superclass of Luk/co/ribot/easyadapter/EasyRecyclerAdapter; (7387)
07-19 14:18:25.680 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ Link of class 'Luk/co/ribot/easyadapter/EasyRecyclerAdapter;' failed
07-19 14:18:26.240 18930-18930/com.juliushuijnk.tools.ideagrowr V/App﹕ onCreate App - after AA
07-19 14:18:26.471 18930-18930/com.juliushuijnk.tools.ideagrowr V/App﹕ end of onCreate App
07-19 14:18:26.559 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
07-19 14:18:26.559 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ VFY: unable to resolve virtual method 630: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
07-19 14:18:26.560 18930-18930/com.juliushuijnk.tools.ideagrowr I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
07-19 14:18:26.560 18930-18930/com.juliushuijnk.tools.ideagrowr W/dalvikvm﹕ VFY: unable to resolve virtual method 652: Landroid/content/res/TypedArray;.getType (I)I
07-19 14:18:26.822 18930-18930/com.juliushuijnk.tools.ideagrowr V/MainActivity﹕ called onCreate MainActivity

Google Analytics 出了点问题,但这并不是导致应用启动速度变慢的主要原因。主要问题似乎是像这样的行:

Unable to resolve superclass of Landroid/support/v4/app/ActivityCompat21$SharedElementCallbackImpl; (54)

我不知道如何解决这些问题,因为其他带有此类日志消息的 StackOverflow 帖子假定它与 .jar 库有关并且在 Eclipse 上。

喜欢这里: Android - Unable to resolve superclass两者都不适用于我的问题(据我了解)。

在 Nexus 7 (2013) 上,应用程序的启动也很慢,但日志文件给出了不同的读数:

07-19 14:48:05.631  26840-26840/com.juliushuijnk.tools.ideagrowr V/App﹕ onCreate App - before GoogleAnalytics.getInstance(this)
07-19 14:48:05.640 26840-26840/com.juliushuijnk.tools.ideagrowr I/GAv4﹕ Google Analytics 7.5.71 is starting up. To enable debug logging on a device run:
adb shell setprop log.tag.GAv4 DEBUG
adb logcat -s GAv4
07-19 14:48:05.645 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.MainActivity
07-19 14:48:05.656 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.AllIdeasActivity
07-19 14:48:05.656 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.AllNotesActivity
07-19 14:48:05.656 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.CreateIdeaActivity
07-19 14:48:05.656 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.CreateNoteActivity
07-19 14:48:05.657 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.DeleteIdeaActivity
07-19 14:48:05.657 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.OverviewActivity
07-19 14:48:05.657 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.InfoActivity
07-19 14:48:05.658 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.EditQsetActivity
07-19 14:48:05.658 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.LikeActivity
07-19 14:48:05.658 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.MigrateDatabaseActivity
07-19 14:48:05.658 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.SettingsActivity
07-19 14:48:05.659 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ String xml configuration name not recognized: com.juliushuijnk.tools.ideagrowr.UpdateCoreActivity
07-19 14:48:05.659 26840-26840/com.juliushuijnk.tools.ideagrowr W/GAv4﹕ Bool xml configuration name not recognized: ga_reportUncaughtExceptions
07-19 14:48:05.689 26840-26840/com.juliushuijnk.tools.ideagrowr V/App﹕ onCreate App - after GA
07-19 14:48:06.082 26840-26840/com.juliushuijnk.tools.ideagrowr W/art﹕ Before Android 4.1, method int android.support.v7.internal.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
07-19 14:48:07.580 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter$RecyclerViewHolder>
07-19 14:48:07.580 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter$RecyclerViewHolder>
07-19 14:48:07.581 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter>
07-19 14:48:07.581 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter>
07-19 14:48:07.583 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.BaseEasyRecyclerAdapter>
07-19 14:48:07.583 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.EasyRecyclerAdapter>
07-19 14:48:07.583 26840-26840/com.juliushuijnk.tools.ideagrowr I/art﹕ Rejecting re-init on previously-failed class java.lang.Class<uk.co.ribot.easyadapter.EasyRecyclerAdapter>
07-19 14:48:07.592 26840-26840/com.juliushuijnk.tools.ideagrowr V/App﹕ onCreate App - after AA
07-19 14:48:07.606 26840-26840/com.juliushuijnk.tools.ideagrowr V/App﹕ end of onCreate App
07-19 14:48:07.690 26840-26840/com.juliushuijnk.tools.ideagrowr V/MainActivity﹕ called onCreate MainActivity

虽然大部分内容我都没有完全理解,但我认为这是最奇怪的一行:

Before Android 4.1, method int android.support.v7.internal.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView

如果有帮助, list 文件的开头:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.juliushuijnk.tools.ideagrowr"
android:installLocation="auto" >

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.myTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

进一步的背景:我不是专业的软件开发人员,这是一个宠物项目。学习如何解决这样的问题也很棒。

最佳答案

我自己想通了。所以最后,这是由于我如何实现 ActiveAndroid 库。

除非您使用有助于 AA 快速找到模型的配置,否则它只会让您的应用启动非常慢。

我用这段代码修复了它: How to disable scanning for model in Activeandroid

这样的代码(但我有不同的型号名称):

 Configuration.Builder configurationBuilder = new Configuration.Builder(this);
configurationBuilder.addModelClasses(Test.class);
configurationBuilder.addModelClasses(ShoppingList.class);
configurationBuilder.addModelClasses(ShoppingListItem.class);
configurationBuilder.addModelClasses(ArticleInfoModel.class);

ActiveAndroid.initialize(configurationBuilder.create());

现在几乎是即时启动。我仍然不确定为什么我会收到所有这些奇怪的 logcat 条目。所有“无法解析父类(super class)”可能是 AA 在没有配置的情况下如何运行的某种间接产物。自从我添加配置后,这些行现在消失了。

这些 logcat 行让我在寻找与 gradle 和支持库有关的答案时感到困惑,但这不是问题的根源。

所以我应该从一开始就实现该配置。但它在 AA 的写作方式让人感觉“拥有它很高兴”。

https://github.com/pardom/ActiveAndroid/wiki/Creating-your-database-mode

所以我了解到,下次当我看到一些我认为“很高兴拥有”的东西时,我应该在评论中写下我的假设,这样我就可以在遇到问题时快速了解我可能需要更改的地方。 .

感谢 Danielson 的帮助:)。

关于java - Android 应用程序启动缓慢,但启动缓慢后运行良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31501650/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com