###前提・実現したいこと
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 }

回答3件
あなたの回答
tips
プレビュー