夏休みの工作・自由研究におすすめ
Handmade Electronic Music ―手作り電子回路から生まれる音と音楽 (Make: PROJECTS)
バネを使った、「ぼよよ~ん」玩具のヒントがあるかも
« 2016年04月 | メイン | 2017年08月 »
Handmade Electronic Music ―手作り電子回路から生まれる音と音楽 (Make: PROJECTS)
バネを使った、「ぼよよ~ん」玩具のヒントがあるかも
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.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536メソッド数の上限を超えた(Building Apps with Over 65K Methods)
apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion "23.0.3" defaultConfig { applicationId "asia.remix.map" minSdkVersion 10 targetSdkVersion 24 versionCode 1 versionName "1.0" multiDexEnabled true ★追加 } 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.1.1' compile 'com.google.android.gms:play-services:9.4.0' }と
<?xml version="1.0" encoding="utf-8"?> <manifest package="example.myapplication" xmlns:android="http://schemas.android.com/apk/res/android" > <!-- The ACCESS_COARSE/FINE_LOCATION permissions are not required to use Google Maps Android API v2, but you must specify either coarse or fine location permissions for the 'MyLocation' functionality. --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" android:name="android.support.multidex.MultiDexApplication" ★追加 > <!-- The API key for Google Maps-based APIs is defined as a string resource. (See the file "res/values/google_maps_api.xml"). Note that the API key is linked to the encryption key used to sign the APK. You need a different API key for each encryption key, including the release key that is used to sign the APK for publishing. You can define the keys for the debug and release targets in src/debug/ and src/release/. --> <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key" /> <activity android:name=".MapsActivity" android:label="@string/title_activity_maps" > <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> </manifest>それぞれ ★印の行を追加。
org.gradle.jvmargs=-Xmx2048mを指定するとメモリ不足解消とコンパイル時間を短縮(約1/10)。
String[] strings = { "1列目", "2列目", "3列目" }; ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>( getApplicationContext() , android.R.layout.simple_list_item_1 , strings );
ArrayList<HashMap<String, Object>> arrayList = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object> map = new HashMap<String, Object>(); map.put( "display", "1列目" ); map.put( "offset", 1 ); arrayList.add( map ); map.put( "display", "2列目" ); map.put( "offset", 2 ); arrayList.add( map ); map.put( "display", "3列目" ); map.put( "offset", 3 ); arrayList.add( map ); SimpleAdapter simpleAdapter = new SimpleAdapter( getApplicationContext() , arrayList , android.R.layout.simple_list_item_1 ←★ , new String[]{ "display"}, new int[]{android.R.id.text1} ←★ );
Android ADK 組込みプログラミング完全ガイド (Smart Mobile Developer)
全サンプルコードは
https://www.shoeisha.co.jp/book/detail/9784798125930
からダウンロード可能。
『第8章 Android 対応の電子オルゴールを作る』
の簡易サンプルの画面・・・▼