日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > Android >内容正文

Android

android 时间应用程序,Android在首次启动时需要更多时间启动应用程序

發(fā)布時間:2025/3/12 Android 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android 时间应用程序,Android在首次启动时需要更多时间启动应用程序 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

在我的項目中,我使用了需要multidex支持的庫。 根據(jù)我的研究,我發(fā)現(xiàn)它會導(dǎo)致應(yīng)用啟動時出現(xiàn)延遲。

我在gradle中啟用了multidexfunction。 defaultConfig {multiDexEnabled true}

我曾經(jīng)為kitkat設(shè)備獲得NoClassDefFound Exception,所以我添加了以下內(nèi)容:

我在清單中添加了應(yīng)用程序名稱為android:name =“android.support.multidex.MultiDexApplication”

并使用MultiDexApplication擴展了我的應(yīng)用程序類。

我知道上面的任何一個都足夠但我剛剛寫了兩個。

我嘗試了不同的方法來優(yōu)化啟動的持續(xù)時間,如下所示:

1.added productFlavors {dev {minSdkVersion 21} prod {minSdkVersion 14}}

dexOptions {preDexLibraries false javaMaxHeapSize“4g”}

我只導(dǎo)入了必需的google play服務(wù)庫,而不是導(dǎo)入完整的庫。

你能不能建議我一種即興創(chuàng)作的方法,因為它實際上需要超過10秒,有時甚至超過某些設(shè)備?

或者是否有任何其他原因?qū)е卵舆t與multidex相比?

提前致謝。

我添加了build.gradle文件內(nèi)容:

apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 buildToolsVersion "23.0.3" useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "com.example.app" minSdkVersion 17 targetSdkVersion 23 versionCode 3 versionName "1.2" multiDexEnabled true } dexOptions { incremental true javaMaxHeapSize "10g" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile files('libs/ormlite-android-4.28.jar') compile files('libs/ormlite-core-4.28.jar') compile project(':volley') compile 'com.android.support:cardview-v7:23.2.1' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.google.code.gson:gson:2.3.1' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar' compile 'com.viewpagerindicator:library:2.4.1@aar' compile 'com.android.support:design:23.2.1' compile 'com.facebook.android:facebook-android-sdk:4.1.2' compile 'org.jsoup:jsoup:1.8.2' compile 'org.twitter4j:twitter4j:4.0.3' compile 'com.github.castorflex.smoothprogressbar:library-circular:1.1.0' compile 'com.orhanobut:dialogplus:1.11@aar' compile 'com.google.android.gms:play-services-maps:8.3.0' compile 'co m.google.android.gms:play-services-gcm:8.3.0' compile 'com.google.android.gms:play-services-location:8.3.0' compile 'org.java-websocket:Java-WebSocket:1.3.0' compile 'org.apache.commons:commons-lang3:3.4' compile 'com.android.support:multidex:1.0.1' compile 'com.android.support:recyclerview-v7:23.1.1' }

新發(fā)布的Android Studio 2.0或2.1存在一個奇怪的問題。 第一次啟動應(yīng)用程序需要比平時更長的時間。 此問題僅在調(diào)試模式下發(fā)生,不會對您發(fā)布的APK產(chǎn)生影響。 我也遇到了這個問題,并find了這個解決方案。

Settings/Preferences(Mac) → Build, Execution, Deployment → Instant Run and uncheck Instant Run

這將解決您的問題,如果是,請標(biāo)記為已接受的答案。

android studio 2.0和2.1版中存在一個問題,但答案很簡單。 您必須轉(zhuǎn)到首選項/構(gòu)建,執(zhí)行,部署/即時運行。

然后,當(dāng)您單擊右側(cè)的“即時運行”時,將顯示4個選項,其中包含一個echa one的checkbox,您必須取消選中第一個和最后一個。 最后單擊Apply,Ok。 就這樣。

這將解決問題

總結(jié)

以上是生活随笔為你收集整理的android 时间应用程序,Android在首次启动时需要更多时间启动应用程序的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。