【发布时间】:2018-01-31 07:25:21
【问题描述】:
我有一个简单的应用程序,我在其中使用 openssl 进行一些加密。 但我在启动应用程序时出现白屏超过 5 秒。
这是我的毕业作品:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'manvish'
keyPassword 'manvish'
storeFile file('/home/manvish/Android/debug.keystore')
storePassword 'manvish'
}
}
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example.manvish.bwssb"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
android {
defaultConfig {
ndk {
moduleName "myLibrary"
ldLibs "log"
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile files('libs/MorphoSmart_SDK_6.13.2.0-4.1.jar')
// compile 'com.google.android.gms:play-services-location:11.0.4'
// compile 'com.google.android.gms:play-services-maps:11.0.4'
compile files('libs/commons-io-2.4.jar')
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile('org.apache.httpcomponents:httpcore:4.4.1') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
}
看看Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := ssl_static
LOCAL_SRC_FILES := precompiled/libssl.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := crypto_static
LOCAL_SRC_FILES :=precompiled/libcrypto.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := myLibrary
TARGET_PLATFORM := android-3
LOCAL_SRC_FILES := native-lib.cpp
LOCAL_C_INCLUDES = $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := ssl_static crypto_static
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
我没有得到白屏背后的原因,一些 SO 答案建议在主题中使用它:
<item name="android:windowDisablePreview">true</item>
但我不想使用它。这不是一个合适的解决方案,因为它避免了白屏,但加载应用程序的延迟仍然相同。请帮助解决这个问题。
【问题讨论】:
-
无法删除,但可以替换。
-
@Heisen-Berg 但为什么它来了我的意思是白屏什么是技术原因.. bcz 我没有在应用程序启动时加载任何繁重的东西
-
如果您在应用启动时执行长时间操作,请考虑在不同线程中执行这些操作。
AsyncTask、Handler等
标签: android android-design-library