Android 最近调用了应用程序 class 方法 onCreate
Android Application class method onCreate being called lately
我已经重载了 Application class in my android app and i'm using
IAviaryClientCredentials` 接口。
public class AppypieApplication extends Application implements IAviaryClientCredentials
{
public ArrayList<BookInformation> bis;
public SkyDatabase sd = null;
public int sortType=0;
public ArrayList<CustomFont> customFonts = new ArrayList<CustomFont>();
private static AppypieApplication mInstance;
private static String CREATIVE_SDK_SAMPLE_CLIENT_ID;
private static String CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
private QBUser currentUser;
private MediaPlayerManager soundPlayer;
private Map<Integer, QBUser> dialogsUsers = new HashMap<Integer, QBUser>();
@Override
public void onCreate()
{
super.onCreate();
Toast.makeText(AppypieApplication.this,"AppypieApplication",Toast.LENGTH_LONG).show();
String applicationId = getString(R.string.app_chrome_cast_id);
QBSettings.getInstance().fastConfigInit(Consts.QB_APP_ID, Consts.QB_AUTH_KEY, Consts.QB_AUTH_SECRET);
String manufacturer = android.os.Build.MANUFACTURER;
System.out.println("device manufacturer==="+manufacturer);
if (!manufacturer.equalsIgnoreCase("amazon")) {
try {
VideoCastManager.initialize(this, CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID, null, null).
setVolumeStep(0.5).
enableFeatures(VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN |
VideoCastManager.FEATURE_WIFI_RECONNECT |
VideoCastManager.FEATURE_CAPTIONS_PREFERENCE);
} catch (Exception e) {
e.printStackTrace();
}
}
CREATIVE_SDK_SAMPLE_CLIENT_ID=getString(R.string.creative_sdk_client_id);
CREATIVE_SDK_SAMPLE_CLIENT_SECRET=getString(R.string.creative_sdk_secret_id);
AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());
if (!manufacturer.equalsIgnoreCase("amazon")) {
AnalyticsTrackers.initialize(this);
AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
}
initApplication();
registerActivityLifecycleCallbacks(new ActivityLifecycleHandler());
}
问题:
案例 1:当我 运行 来自 studio 2.1.1
的代码时,应用程序工作正常
情况 2:当我 clear-app-data
时,大约需要 2 分钟才能到达应用程序 Class 的 onCreate()
。
情况 3:当有人第一次使用 apk 和 install/run 应用程序时,大约需要 2 分钟才能到达应用程序 Class 的 onCreate()
,之后一切正常。
OS Version 6.0
更新 1
我的 gradle 文件。
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.kljdrfqwxcqgzzimiygdcwrshoxalmfyuonetatuvj"
minSdkVersion 15
targetSdkVersion 22
versionCode 30
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
lintOptions{
disable "ResourceType"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
incremental = true;
javaMaxHeapSize "4g"
preDexLibraries = false
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
allprojects {
apply plugin: 'maven'
repositories {
mavenCentral()
jcenter()
maven {
url "${project.rootDir}/creativesdk-repo/release"
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar',dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.android.gms:play-services:7.+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile('com.adobe.creativesdk.foundation:auth:0.7.329') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'support-v4'
}
compile('com.adobe.creativesdk:image:4.0.0') {
exclude module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
}
compile('com.android.support:multidex:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
}
compile files('libs/commons-io-2.4.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/aacdecoder-android-0.8.jar')
compile files('libs/skyepub.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/anjlab-iabv3-1.0.23.jar')
compile files('libs/quickblox-android-sdk-chat-2.1.jar')
compile files('libs/quickblox-android-sdk-content-2.1.jar')
compile files('libs/quickblox-android-sdk-core-2.1.jar')
compile files('libs/quickblox-android-sdk-location-2.1.jar')
compile files('libs/quickblox-android-sdk-messages-2.1.jar')
compile files('libs/quickblox-android-sdk-videochat-webrtc-2.1.jar')
compile files('libs/android-support-v4.jar')
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:support-annotations:22.2.0'
compile ('com.android.support:support-v4:23.1.1')
{
force=true
}
compile ('com.android.support:support-annotations:23.1.1')
{
force=true
}
compile project(':stripe')
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile project(':vitamio')
compile project(':zxing-scan')
compile('com.twitter.sdk.android:twitter:2.0.0@aar') {
transitive = true;
}
compile project(':libraryProject_AppypiePdf')
compile project(':linkedin-sdk')
compile project(':CastCompanionLibrary-android')
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
compile project(path: ':de.keyboardsurfer.android.widget.crouton')
compile project(path: ':pull-to-refresh')
}
更新 2
我在V4库的冲突中发现了一些麻烦,但我设法摆脱了它。 :D
Sucessfully apk generated:
Information:Gradle tasks [:app:assembleDebug]
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(jnamed) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(jnamed) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(jnamed) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.xbill.DNS.UDPClient) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Information:BUILD SUCCESSFUL
Information:Total time: 1 mins 44.355 secs
Information:32 errors
Information:0 warnings
Information:See complete output in console
在那之后 AppypieApplication.java
崩溃了
Logcat:
01-03 12:44:06.024 30385-30385/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.twheels, PID: 30385
java.lang.NoClassDefFoundError: android.support.v7.media.MediaRouter$GlobalMediaRouter
at android.support.v7.media.MediaRouter$GlobalMediaRouter.<init>(MediaRouter.java:1628)
at android.support.v7.media.MediaRouter.getInstance(MediaRouter.java:246)
at com.google.android.libraries.cast.companionlibrary.cast.BaseCastManager.<init>(BaseCastManager.java:189)
at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.<init>(VideoCastManager.java:197)
at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.initialize(VideoCastManager.java:224)
at com.app.twheels.AppypieApplication.onCreate(AppypieApplication.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4728)
at android.app.ActivityThread.access00(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
AppypieApplication.java代码:
package com.app.kljdrfqwxcqgzzimiygdcwrshoxalmfyuonetatuvj;
/**
* Created by maven on 5/25/2016.
*/
public class AppypieApplication extends Application implements IAviaryClientCredentials
{
public ArrayList<BookInformation> bis;
public SkyDatabase sd = null;
public int sortType=0;
public ArrayList<CustomFont> customFonts = new ArrayList<CustomFont>();
private static AppypieApplication mInstance;
private static String CREATIVE_SDK_SAMPLE_CLIENT_ID;
private static String CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
private QBUser currentUser;
private MediaPlayerManager soundPlayer;
private Map<Integer, QBUser> dialogsUsers = new HashMap<Integer, QBUser>();
@Override
public void onCreate()
{
super.onCreate();
String applicationId = getString(R.string.app_chrome_cast_id);
QBSettings.getInstance().fastConfigInit(Consts.QB_APP_ID, Consts.QB_AUTH_KEY, Consts.QB_AUTH_SECRET);
String manufacturer = android.os.Build.MANUFACTURER;
System.out.println("krishna device manufacturer==="+manufacturer);
if (!manufacturer.equalsIgnoreCase("amazon")) {
try {
/*
VideoCastManager.initialize(this, CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID, null, null).
setVolumeStep(0.5).
enableFeatures(VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN |
VideoCastManager.FEATURE_WIFI_RECONNECT |
VideoCastManager.FEATURE_CAPTIONS_PREFERENCE);
*/
} catch (Exception e) {
e.printStackTrace();
}
}
CREATIVE_SDK_SAMPLE_CLIENT_ID=getString(R.string.creative_sdk_client_id);
CREATIVE_SDK_SAMPLE_CLIENT_SECRET=getString(R.string.creative_sdk_secret_id);
AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());
if (!manufacturer.equalsIgnoreCase("amazon")) {
AnalyticsTrackers.initialize(this);
AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
}
initApplication();
registerActivityLifecycleCallbacks(new ActivityLifecycleHandler());
}
public void reloadBookInformations()
{
this.bis = sd.fetchBookInformations(sortType,"");
}
public void reloadBookInformations(String key)
{
this.bis = sd.fetchBookInformations(sortType,key);
}
@Override
public String getBillingKey() {
return "";
}
@Override
public String getClientID() {
return CREATIVE_SDK_SAMPLE_CLIENT_ID;
}
@Override
public String getClientSecret() {
return CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
}
public static synchronized AppypieApplication getInstance() {
return mInstance;
}
public synchronized Tracker getGoogleAnalyticsTracker() {
AnalyticsTrackers analyticsTrackers = AnalyticsTrackers.getInstance();
return analyticsTrackers.get(AnalyticsTrackers.Target.APP);
}
public void trackScreenView(String screenName) {
Tracker t = getGoogleAnalyticsTracker();
t.setScreenName(screenName);
t.send(new HitBuilders.ScreenViewBuilder().build());
GoogleAnalytics.getInstance(this).dispatchLocalHits();
}
public void trackException(Exception e) {
if (e != null) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(
new StandardExceptionParser(this, null)
.getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
public void trackEvent(String category, String action, String label) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label).build());
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);;
}
public void callQuickBlox(){
initApplication();
}
// for quickblox chat
private void initApplication() {
mInstance = this;
// QBChatService.setDebugEnabled(true);
initImageLoader(this);
// QBSettings.getInstance().fastConfigInit(Consts.QB_APP_ID, Consts.QB_AUTH_KEY,
// Consts.QB_AUTH_SECRET);
soundPlayer = new MediaPlayerManager(this);
new PrefsHelper(this);
}
private void initImageLoader(Context context) {
ImageLoader.getInstance().init(ImageUtils.getImageLoaderConfiguration(context));
}
public MediaPlayerManager getMediaPlayer() {
return soundPlayer;
}
public QBUser getCurrentUser() {
return currentUser;
}
public void setCurrentUser(QBUser currentUser) {
this.currentUser = currentUser;
}
public Map<Integer, QBUser> getDialogsUsers() {
return dialogsUsers;
}
public void setDialogsUsers(List<QBUser> setUsers) {
dialogsUsers.clear();
for (QBUser user : setUsers) {
dialogsUsers.put(user.getId(), user);
}
}
public void addDialogsUsers(List<QBUser> newUsers) {
for (QBUser user : newUsers) {
dialogsUsers.put(user.getId(), user);
}
}
public Integer getOpponentIDForPrivateDialog(QBDialog dialog){
Integer opponentID = -1;
for(Integer userID : dialog.getOccupants()){
if(!userID.equals(getCurrentUser().getId())){
opponentID = userID;
break;
}
}
return opponentID;
}
}
如有任何建议和帮助,我们将不胜感激。
您必须删除您正在使用的一些库。是否有任何不需要的内容正在写入 gradle 文件。?
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.kljdrfqwxcqgzzimiygdcwrshoxalmfyuonetatuvj"
minSdkVersion 15
targetSdkVersion 22
versionCode 30
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
lintOptions{
disable "ResourceType"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
incremental = true;
javaMaxHeapSize "4g"
preDexLibraries = false
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
allprojects {
apply plugin: 'maven'
repositories {
mavenCentral()
jcenter()
maven {
url "${project.rootDir}/creativesdk-repo/release"
}
}
}
dependencies {
//compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar',dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.android.gms:play-services:7.+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile('com.adobe.creativesdk.foundation:auth:0.7.329') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'support-v4'
}
compile('com.adobe.creativesdk:image:4.0.0') {
exclude module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
}
compile('com.android.support:multidex:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
}
//compile files('libs/commons-io-2.4.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/aacdecoder-android-0.8.jar')
compile files('libs/skyepub.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/anjlab-iabv3-1.0.23.jar')
compile files('libs/quickblox-android-sdk-chat-2.1.jar')
compile files('libs/quickblox-android-sdk-content-2.1.jar')
compile files('libs/quickblox-android-sdk-core-2.1.jar')
compile files('libs/quickblox-android-sdk-location-2.1.jar')
compile files('libs/quickblox-android-sdk-messages-2.1.jar')
compile files('libs/quickblox-android-sdk-videochat-webrtc-2.1.jar')
//compile files('libs/android-support-v4.jar')
compile 'com.android.support:support-v4:22.2.0'
// compile 'com.android.support:support-annotations:22.2.0'
// compile ('com.android.support:support-v4:23.1.1')
// {
// force=true
// }
// compile ('com.android.support:support-annotations:23.1.1')
// {
// force=true
// }
compile project(':stripe')
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile project(':vitamio')
compile project(':zxing-scan')
compile('com.twitter.sdk.android:twitter:2.0.0@aar') {
transitive = true;
}
compile project(':libraryProject_AppypiePdf')
compile project(':linkedin-sdk')
compile project(':CastCompanionLibrary-android')
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
compile project(path: ':de.keyboardsurfer.android.widget.crouton')
compile project(path: ':pull-to-refresh')
}
希望这有帮助。
我已经重载了 Application class in my android app and i'm using
IAviaryClientCredentials` 接口。
public class AppypieApplication extends Application implements IAviaryClientCredentials
{
public ArrayList<BookInformation> bis;
public SkyDatabase sd = null;
public int sortType=0;
public ArrayList<CustomFont> customFonts = new ArrayList<CustomFont>();
private static AppypieApplication mInstance;
private static String CREATIVE_SDK_SAMPLE_CLIENT_ID;
private static String CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
private QBUser currentUser;
private MediaPlayerManager soundPlayer;
private Map<Integer, QBUser> dialogsUsers = new HashMap<Integer, QBUser>();
@Override
public void onCreate()
{
super.onCreate();
Toast.makeText(AppypieApplication.this,"AppypieApplication",Toast.LENGTH_LONG).show();
String applicationId = getString(R.string.app_chrome_cast_id);
QBSettings.getInstance().fastConfigInit(Consts.QB_APP_ID, Consts.QB_AUTH_KEY, Consts.QB_AUTH_SECRET);
String manufacturer = android.os.Build.MANUFACTURER;
System.out.println("device manufacturer==="+manufacturer);
if (!manufacturer.equalsIgnoreCase("amazon")) {
try {
VideoCastManager.initialize(this, CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID, null, null).
setVolumeStep(0.5).
enableFeatures(VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN |
VideoCastManager.FEATURE_WIFI_RECONNECT |
VideoCastManager.FEATURE_CAPTIONS_PREFERENCE);
} catch (Exception e) {
e.printStackTrace();
}
}
CREATIVE_SDK_SAMPLE_CLIENT_ID=getString(R.string.creative_sdk_client_id);
CREATIVE_SDK_SAMPLE_CLIENT_SECRET=getString(R.string.creative_sdk_secret_id);
AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());
if (!manufacturer.equalsIgnoreCase("amazon")) {
AnalyticsTrackers.initialize(this);
AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
}
initApplication();
registerActivityLifecycleCallbacks(new ActivityLifecycleHandler());
}
问题:
案例 1:当我 运行 来自 studio 2.1.1
的代码时,应用程序工作正常
情况 2:当我
clear-app-data
时,大约需要 2 分钟才能到达应用程序 Class 的onCreate()
。情况 3:当有人第一次使用 apk 和 install/run 应用程序时,大约需要 2 分钟才能到达应用程序 Class 的
onCreate()
,之后一切正常。
OS Version 6.0
更新 1
我的 gradle 文件。
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.kljdrfqwxcqgzzimiygdcwrshoxalmfyuonetatuvj"
minSdkVersion 15
targetSdkVersion 22
versionCode 30
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
lintOptions{
disable "ResourceType"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
incremental = true;
javaMaxHeapSize "4g"
preDexLibraries = false
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
allprojects {
apply plugin: 'maven'
repositories {
mavenCentral()
jcenter()
maven {
url "${project.rootDir}/creativesdk-repo/release"
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar',dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.android.gms:play-services:7.+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile('com.adobe.creativesdk.foundation:auth:0.7.329') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'support-v4'
}
compile('com.adobe.creativesdk:image:4.0.0') {
exclude module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
}
compile('com.android.support:multidex:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
}
compile files('libs/commons-io-2.4.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/aacdecoder-android-0.8.jar')
compile files('libs/skyepub.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/anjlab-iabv3-1.0.23.jar')
compile files('libs/quickblox-android-sdk-chat-2.1.jar')
compile files('libs/quickblox-android-sdk-content-2.1.jar')
compile files('libs/quickblox-android-sdk-core-2.1.jar')
compile files('libs/quickblox-android-sdk-location-2.1.jar')
compile files('libs/quickblox-android-sdk-messages-2.1.jar')
compile files('libs/quickblox-android-sdk-videochat-webrtc-2.1.jar')
compile files('libs/android-support-v4.jar')
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:support-annotations:22.2.0'
compile ('com.android.support:support-v4:23.1.1')
{
force=true
}
compile ('com.android.support:support-annotations:23.1.1')
{
force=true
}
compile project(':stripe')
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile project(':vitamio')
compile project(':zxing-scan')
compile('com.twitter.sdk.android:twitter:2.0.0@aar') {
transitive = true;
}
compile project(':libraryProject_AppypiePdf')
compile project(':linkedin-sdk')
compile project(':CastCompanionLibrary-android')
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
compile project(path: ':de.keyboardsurfer.android.widget.crouton')
compile project(path: ':pull-to-refresh')
}
更新 2
我在V4库的冲突中发现了一些麻烦,但我设法摆脱了它。 :D
Sucessfully apk generated:
Information:Gradle tasks [:app:assembleDebug]
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(jnamed) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(jnamed) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(jnamed) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.xbill.DNS.UDPClient) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is not an inner class.
Information:BUILD SUCCESSFUL
Information:Total time: 1 mins 44.355 secs
Information:32 errors
Information:0 warnings
Information:See complete output in console
在那之后 AppypieApplication.java
崩溃了Logcat:
01-03 12:44:06.024 30385-30385/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.app.twheels, PID: 30385
java.lang.NoClassDefFoundError: android.support.v7.media.MediaRouter$GlobalMediaRouter
at android.support.v7.media.MediaRouter$GlobalMediaRouter.<init>(MediaRouter.java:1628)
at android.support.v7.media.MediaRouter.getInstance(MediaRouter.java:246)
at com.google.android.libraries.cast.companionlibrary.cast.BaseCastManager.<init>(BaseCastManager.java:189)
at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.<init>(VideoCastManager.java:197)
at com.google.android.libraries.cast.companionlibrary.cast.VideoCastManager.initialize(VideoCastManager.java:224)
at com.app.twheels.AppypieApplication.onCreate(AppypieApplication.java:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4728)
at android.app.ActivityThread.access00(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
AppypieApplication.java代码:
package com.app.kljdrfqwxcqgzzimiygdcwrshoxalmfyuonetatuvj;
/**
* Created by maven on 5/25/2016.
*/
public class AppypieApplication extends Application implements IAviaryClientCredentials
{
public ArrayList<BookInformation> bis;
public SkyDatabase sd = null;
public int sortType=0;
public ArrayList<CustomFont> customFonts = new ArrayList<CustomFont>();
private static AppypieApplication mInstance;
private static String CREATIVE_SDK_SAMPLE_CLIENT_ID;
private static String CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
private QBUser currentUser;
private MediaPlayerManager soundPlayer;
private Map<Integer, QBUser> dialogsUsers = new HashMap<Integer, QBUser>();
@Override
public void onCreate()
{
super.onCreate();
String applicationId = getString(R.string.app_chrome_cast_id);
QBSettings.getInstance().fastConfigInit(Consts.QB_APP_ID, Consts.QB_AUTH_KEY, Consts.QB_AUTH_SECRET);
String manufacturer = android.os.Build.MANUFACTURER;
System.out.println("krishna device manufacturer==="+manufacturer);
if (!manufacturer.equalsIgnoreCase("amazon")) {
try {
/*
VideoCastManager.initialize(this, CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID, null, null).
setVolumeStep(0.5).
enableFeatures(VideoCastManager.FEATURE_NOTIFICATION |
VideoCastManager.FEATURE_LOCKSCREEN |
VideoCastManager.FEATURE_WIFI_RECONNECT |
VideoCastManager.FEATURE_CAPTIONS_PREFERENCE);
*/
} catch (Exception e) {
e.printStackTrace();
}
}
CREATIVE_SDK_SAMPLE_CLIENT_ID=getString(R.string.creative_sdk_client_id);
CREATIVE_SDK_SAMPLE_CLIENT_SECRET=getString(R.string.creative_sdk_secret_id);
AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());
if (!manufacturer.equalsIgnoreCase("amazon")) {
AnalyticsTrackers.initialize(this);
AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
}
initApplication();
registerActivityLifecycleCallbacks(new ActivityLifecycleHandler());
}
public void reloadBookInformations()
{
this.bis = sd.fetchBookInformations(sortType,"");
}
public void reloadBookInformations(String key)
{
this.bis = sd.fetchBookInformations(sortType,key);
}
@Override
public String getBillingKey() {
return "";
}
@Override
public String getClientID() {
return CREATIVE_SDK_SAMPLE_CLIENT_ID;
}
@Override
public String getClientSecret() {
return CREATIVE_SDK_SAMPLE_CLIENT_SECRET;
}
public static synchronized AppypieApplication getInstance() {
return mInstance;
}
public synchronized Tracker getGoogleAnalyticsTracker() {
AnalyticsTrackers analyticsTrackers = AnalyticsTrackers.getInstance();
return analyticsTrackers.get(AnalyticsTrackers.Target.APP);
}
public void trackScreenView(String screenName) {
Tracker t = getGoogleAnalyticsTracker();
t.setScreenName(screenName);
t.send(new HitBuilders.ScreenViewBuilder().build());
GoogleAnalytics.getInstance(this).dispatchLocalHits();
}
public void trackException(Exception e) {
if (e != null) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.ExceptionBuilder()
.setDescription(
new StandardExceptionParser(this, null)
.getDescription(Thread.currentThread().getName(), e))
.setFatal(false)
.build()
);
}
}
public void trackEvent(String category, String action, String label) {
Tracker t = getGoogleAnalyticsTracker();
t.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label).build());
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);;
}
public void callQuickBlox(){
initApplication();
}
// for quickblox chat
private void initApplication() {
mInstance = this;
// QBChatService.setDebugEnabled(true);
initImageLoader(this);
// QBSettings.getInstance().fastConfigInit(Consts.QB_APP_ID, Consts.QB_AUTH_KEY,
// Consts.QB_AUTH_SECRET);
soundPlayer = new MediaPlayerManager(this);
new PrefsHelper(this);
}
private void initImageLoader(Context context) {
ImageLoader.getInstance().init(ImageUtils.getImageLoaderConfiguration(context));
}
public MediaPlayerManager getMediaPlayer() {
return soundPlayer;
}
public QBUser getCurrentUser() {
return currentUser;
}
public void setCurrentUser(QBUser currentUser) {
this.currentUser = currentUser;
}
public Map<Integer, QBUser> getDialogsUsers() {
return dialogsUsers;
}
public void setDialogsUsers(List<QBUser> setUsers) {
dialogsUsers.clear();
for (QBUser user : setUsers) {
dialogsUsers.put(user.getId(), user);
}
}
public void addDialogsUsers(List<QBUser> newUsers) {
for (QBUser user : newUsers) {
dialogsUsers.put(user.getId(), user);
}
}
public Integer getOpponentIDForPrivateDialog(QBDialog dialog){
Integer opponentID = -1;
for(Integer userID : dialog.getOccupants()){
if(!userID.equals(getCurrentUser().getId())){
opponentID = userID;
break;
}
}
return opponentID;
}
}
如有任何建议和帮助,我们将不胜感激。
您必须删除您正在使用的一些库。是否有任何不需要的内容正在写入 gradle 文件。?
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.kljdrfqwxcqgzzimiygdcwrshoxalmfyuonetatuvj"
minSdkVersion 15
targetSdkVersion 22
versionCode 30
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
lintOptions{
disable "ResourceType"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
incremental = true;
javaMaxHeapSize "4g"
preDexLibraries = false
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
allprojects {
apply plugin: 'maven'
repositories {
mavenCentral()
jcenter()
maven {
url "${project.rootDir}/creativesdk-repo/release"
}
}
}
dependencies {
//compile fileTree(include: ['*.jar'], exclude: 'android-support-v4.jar',dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.google.android.gms:play-services:7.+'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile('com.adobe.creativesdk.foundation:auth:0.7.329') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'support-v4'
}
compile('com.adobe.creativesdk:image:4.0.0') {
exclude module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
}
compile('com.android.support:multidex:1.0.1') {
exclude group: 'com.android.support', module: 'multidex'
}
//compile files('libs/commons-io-2.4.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/aacdecoder-android-0.8.jar')
compile files('libs/skyepub.jar')
compile files('libs/httpcore-4.3.jar')
compile files('libs/anjlab-iabv3-1.0.23.jar')
compile files('libs/quickblox-android-sdk-chat-2.1.jar')
compile files('libs/quickblox-android-sdk-content-2.1.jar')
compile files('libs/quickblox-android-sdk-core-2.1.jar')
compile files('libs/quickblox-android-sdk-location-2.1.jar')
compile files('libs/quickblox-android-sdk-messages-2.1.jar')
compile files('libs/quickblox-android-sdk-videochat-webrtc-2.1.jar')
//compile files('libs/android-support-v4.jar')
compile 'com.android.support:support-v4:22.2.0'
// compile 'com.android.support:support-annotations:22.2.0'
// compile ('com.android.support:support-v4:23.1.1')
// {
// force=true
// }
// compile ('com.android.support:support-annotations:23.1.1')
// {
// force=true
// }
compile project(':stripe')
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
compile project(':vitamio')
compile project(':zxing-scan')
compile('com.twitter.sdk.android:twitter:2.0.0@aar') {
transitive = true;
}
compile project(':libraryProject_AppypiePdf')
compile project(':linkedin-sdk')
compile project(':CastCompanionLibrary-android')
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'
compile project(path: ':de.keyboardsurfer.android.widget.crouton')
compile project(path: ':pull-to-refresh')
}
希望这有帮助。