2016-09-20 1 views
1

Androidスタジオ2.2を使用すると、デバッグバージョンを使用すると、アプリケーションの切り替えアクティビティが完全に動作します。ただし、Google Playにアプリケーションを公開すると、そのアプリケーションを開くことができますが、他のアクティビティ(インテント経由)を開始しようとするとアプリケーションがクラッシュします。Android relase APKがアクティビティを読み込めません

build.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 
    defaultConfig { 
     applicationId "net.ddns.opencratebox.mycratebox" 
     minSdkVersion 15 
     targetSdkVersion 24 
     versionCode 5 
     versionName "0.0.5" 
    } 
    buildTypes { 
     release { 
      minifyEnabled true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/ASL2.0' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13' 
    compile 'com.google.firebase:firebase-ads:9.4.0' 
    compile 'com.google.android.gms:play-services-ads:9.4.0' 
    compile 'com.firebase:firebase-client-android:2.3.1' 
} 



apply plugin: 'com.google.gms.google-services' 

マニフェスト:

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

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

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="MyCrateBox" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".source.MVC.View.LaunchActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name=".source.MVC.View.RegisterActivity" /> 
     <activity android:name=".source.MVC.View.LoggedActivity" /> 
    </application> 

</manifest> 

私が求めています唯一の権限はインターネットである、と私はそれを宣言しました。とにかく、それは始動活動とは関係ありません。私は何が起こっているのか分かりません。なぜなら、デバッグバージョンは非常に働きます(アンドロイドスタジオから私のタブレットにUSBケーブルで直接インストールしています)。多くの友人も同じ結果を試しました。

Google Playを通じてインストールすると動作しませんが、Android StudioからUSB経由でインストールすると動作します。

誰でもアイデアはありますか?

P.S.すでに偽、結果なしにminifyEnabledを入れてみました:(私はProGuardのは、そのような何かをコンストラクタやコードの一部を削除することができると聞いた

EDIT衝突事象の スタックトレース:。

9月19日20:42:55.127 31614から31614/E/AndroidRuntime:致命的な例外:メイン プロセス:

net.ddns.opencratebox.mycratebox、PID:31614 java.lang.IllegalStateException:メソッドが見つかりませんでした 親または祖先のregisterView(View)android:onClickのコンテキストビュークラスに定義された属性 android.support.v7.widget.AppCompatTextView(IDが 'txvc_register') android.support.v7.app.AppCompatViewInflater $ DeclaredOnClickListener.resolveMethod (AppCompatViewInflater.java:327) android.support.v7.app.AppCompatViewInflater $ DeclaredOnClickListener.onClick(AppCompatViewInflater.java:284) at android.view.View.performClick(View.java:5280) android.view .View $ PerformClick.run(View.java:21239) とandroid.os.Handler.handleCallback(Handler.java:739) とandroid.os.Handler.dispatchMessage(Handler.java:95) android.os.Looper.loop(Looper.java:234) android.app.ActivityThread.main(ActivityThread.java:5526) at java.lang.reflect.Method.invoke(ネイティブメソッド) at com。 android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit。Javaの:616)

他の活動を開始すべきコードを:

protected void registerView(View view) { 
     Intent intent = new Intent(this, RegisterActivity.class); 
     startActivity(intent); 
    } 

クリックボタン表すXML:単に私のメソッドの可視性を変更することにより、固定

<TextView 
     android:id="@+id/txvc_register" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/btn_register" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="42dp" 
     android:clickable="true" 
     android:linksClickable="false" 
     android:onClick="registerView" 
     android:text="@string/or_register" 
     android:textColor="@color/abc_btn_colored_borderless_text_material" /> 
+1

Playストアにアップロードする前にリリースapkをテストしましたか? –

+0

adb install -r myapp.apkでリリースアプリをインストールし、デバッガを接続してlogcatをチェックすると、クラッシュする理由を知ることができます。 – surya

+0

私はapkをテストしましたが、最初のリリース後(私たちはまだそれを行うことができるか分からなかった)私はsuryaを試してみます!ありがとう! – Cratebox99

答えて

3

をprotectedからpublicにonClickによって呼び出されます。

public void registerView(View view) { 
     Intent intent = new Intent(this, RegisterActivity.class); 
     startActivity(intent); 
    } 
+1

https://developer.android.com/reference/android/view/View.html#attr_androidをご覧ください:この要件を示すドキュメントのonClick。 –

関連する問題