質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

3回答

5253閲覧

Android端末でのみ実行できないです

Haku

総合スコア13

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

1クリップ

投稿2016/11/30 09:41

編集2016/12/01 03:30

###前提・実現したいこと
Androidアプリ作成初心者です.
AndroidStudioでSQLiteを使ったプログラムを作っています.

まず,試しに本に掲載されていたプログラムを自分の環境で作成しました.
Sampleを参照しながら同じように記載していったのですが,手持ちのAndroid端末で実行しようとしたところ,エラーが発生してしまいました.

###発生している問題・エラーメッセージ
Androidバージョン 4.2.2の端末で実行しようとしたところ,
ビルドもされず以下のようなエラーが出ました.

エラーメッセージ Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim; ###該当のソースコード AndroidManifest.xml apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "24.0.3" defaultConfig { applicationId "com.************************" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) 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:24.2.1' testCompile 'junit:junit:4.12' }

###試したこと
AndroidStudio上で関連付けられているすべてのファイルをdifffなどをつかってSampleデータと比較してみた結果,上記のAndroidManifest.xmlファイルだけが違っているようでした.CompileSDKVersionが23と24で違うと全く別の記述が必要なのでしょうか.

###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
AndroidManifest.xml(ビルドが通るもの)

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.************************" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <provider android:name=".**********Provider" android:authorities="com.**********************" android:enabled="true" android:exported="true" > </provider> </application> </manifest>

■追記
エラーログということで「logcat」で出力されたログと「messages」の内容を載せます
[logcat]

12-01 10:39:41.193 916-972/? E/UlpEngine: kvs.containsKey(ENH_LOCATION_SERVICES_ENABLED) returned false 12-01 10:39:48.922 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:48.922 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:48.959 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:48.959 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:48.987 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:48.987 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:49.955 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:49.955 406-406/? E/Parcel: Reading a NULL string not supported here. 12-01 10:39:52.055 1119-1119/? E/StatusBar.NetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN 12-01 10:39:52.097 1119-1119/? E/StatusBar.NetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN 12-01 10:39:52.455 21356-21356/? E/dalvikvm: ERROR: couldn't find native method 12-01 10:39:52.455 21356-21356/? E/dalvikvm: Requested: Lcom/access_company/android/nfcommunicator/util/jni/MailerConverterCoreJni;.jniGetX:()[B 12-01 10:39:52.709 916-975/? E/NotificationService: Ignoring notification with icon==0: Notification(pri=0 contentView=com.kddi.android.email/0x10900b9 vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null]) 12-01 10:39:52.725 916-975/? E/NotificationService: Ignoring notification with icon==0: Notification(pri=0 contentView=com.kddi.android.email/0x10900b9 vibrate=null sound=null defaults=0x0 flags=0x62 kind=[null]) 12-01 10:39:55.217 1119-1119/? E/StatusBar.NetworkController: updateDataNetType NETWORK_TYPE_UNKNOWN 12-01 10:40:18.121 916-972/? E/UlpEngine: kvs.containsKey(ENH_LOCATION_SERVICES_ENABLED) returned false 12-01 10:41:43.179 916-972/? E/UlpEngine: kvs.containsKey(ENH_LOCATION_SERVICES_ENABLED) returned false 12-01 10:42:30.184 916-972/? E/UlpEngine: kvs.containsKey(ENH_LOCATION_SERVICES_ENABLED) returned false

[messages]

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug] Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim; Information:BUILD FAILED Information:Total time: 10.609 secs Information:1 error

[build.gradle]
gradleについても追記します.2つを比較したところ,claspath以下の部分でバージョンでしょうか「2.2.2」の部分がSampleでは「2.1.2」となっていました.それ以外は同じでした.

// 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.2' // 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 }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

shotakeu

2016/11/30 09:46

エラーログも貼っていただけるとわかりやすいです
guest

回答3

0

最近しょっちゅう見るエラーなので

java

1Error:Execution failed for task ':app:transformClassesWithDexForDebug'

今まで大丈夫だったのに、Android Studioのバージョンを上げて起きたら
google play serviceの問題だと思います。メソッド数が65Kを越えたのでしょう
build.gradleに

defaultConfig { ... multiDexEnabled true }

で解決する場合もあります
Android Studio 2.2.3の場合は

java

1'com.google.android.gms:play-services:10.0.1'

これがネックで
9.8.0に落とすのが現在のところの対策でしょうか...

投稿2016/12/13 04:06

aja

総合スコア3733

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

com.android.support:appcompat-v7を2箇所でインポートしようとしているようですね。

とりあえずcompile 'com.android.support:appcompat-v7:24.2.1'を削除して改善するかを確認してください。

投稿2016/11/30 10:47

yona

総合スコア18155

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

Haku

2016/12/01 02:20

build.gradle(app)の指摘いただいた部分を削除してみましたが,以下のようなエラーが9個出てしまいました. Error:(9) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. Error:(13, 21) No resource found that matches the given name: attr 'colorAccent'. Error:(11, 21) No resource found that matches the given name: attr 'colorPrimary'. Error:(12, 21) No resource found that matches the given name: attr 'colorPrimaryDark'. Error:(9) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. Error:(13, 21) No resource found that matches the given name: attr 'colorAccent'. Error:(11, 21) No resource found that matches the given name: attr 'colorPrimary'. Error:(12, 21) No resource found that matches the given name: attr 'colorPrimaryDark'. Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: Failed to execute aapt
yona

2016/12/01 02:29

ハズレだったようですね、もとに戻してください。 SampleはCompileSDKVersionが23で 作成中のものは24ということですね? Gradleも質問に追記してください。
guest

0

ベストアンサー

貼ってある情報だけで判断すると

com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim;

com.android.dex.DexException
http://qiita.com/kgmyshin/items/193f86c05c018f013dfc

同じgradleの設定に問題がありそうです

投稿2016/11/30 09:50

shotakeu

総合スコア386

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問