2016-10-11 9 views
1

GPS、インターネット、FusedAPI、KSOAPを使用するアプリケーションを作成しました。アンドロイドスタジオを使用して携帯端末でアプリをデバッグすると、アプリは正常に動作します。しかし、apk(署名済み)を作成すると、Google Map、Fused API、GPSを扱うアクティビティは機能しません。私が見ることができるのは、画面がちらつき、アプリが前のアクティビティに戻ることだけです。アプリケーションはデバッグ中に電話で動作し、apkがインストールされていると動作しません

誰かが間違っている可能性があることを教えてもらえますか?

build.gradle(モジュール)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    dexOptions { 
     javaMaxHeapSize "4g" 
    } 

    defaultConfig { 
     multiDexEnabled true 
     applicationId "online.hannuveda.transafe_rx" 
     minSdkVersion 11 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.0' 

    compile files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies .jar') 
    compile 'com.google.android.gms:play-services:9.4.0' 
    compile 'com.google.maps.android:android-maps-utils:0.3+' 
    compile 'com.github.aakira:expandable-layout:[email protected]' 
} 

build.gradle(プロジェクト)

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
+0

にこの新しいクラスを宣言する必要があります私達にあなたのbuild.gradle、ProGuardの設定および署名APK –

+0

に動作していない活性を示します2 build.gradle、モジュール用、プロジェクト用。どちらが必要ですか? –

+0

多分プロゴアード関連の問題? – Opiatefuchs

答えて

0

は、Googleプレイ・サービスの依存関係('com.google.android.gms:play-services:9.4.0')を使用しているので、あなたのアプリケーションを宣言する必要がありますタイプMultidexApplicationの。

現時点では、マルチレベル設定では不十分なアプリレベルのbuild.gradleファイルにmultiDexEnabled trueを追加しました。マニフェストや依存関係も変更する必要があります。とにかく、命令は次のとおりです。

compile 'com.android.support:multidex:1.0.1' 

2-アプリレベルのbuild.gradleであなたのdefaultConfigsでmultidexを有効にする:

1-アプリのレベルbuild.gradleにmultidex依存関係を追加します。

android { 

defaultConfig { 
    ... 

    // Enabling multidex support. 
    multiDexEnabled true 
    } 
... 
} 

3 MultidexApplicationを拡張する新しいクラスMyApplicationを定義します。このクラスは、アプリケーションのエントリポイントとして機能します。

public class MyApplication extends MultidexApplication 

4 - 最後に、あなたはあなたのAndroidManifest.xmlを

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="your.package.name"> 

<application 
    android:name=".path-to.MyApplication"> 
    ... 
</application> 
</manifest> 
+0

"MyApplication"に何も追加する必要はありません。空のクラスですか? –

+0

は、onCreate()メソッドをオーバーライドするだけです。それでおしまい。 –

+0

今は動作していますか? –

関連する問題