違うスクリプトで、other_store_value を store していると仮定して、

一度、変数の ${other_store_value} を変数 abc に保存します。

もしも、other_store_value が store されていなと、そのまま文字列となるので、

${abc} === ” ${other_store_value}” かをチェックして、処理を分岐できます。

ちょっと、泥臭いですが…

 

自分の環境では、Export 機能はエラーが出て上手く動作しませんでした。

*.side ファイルを調べると内容はJSONファイルなので、

“tests”: [

{

“id”: “d4be14a3-316b-4d41-bf05-693bdc536989”,

“name”: “test_a”, “commands”: [{

・・・

・・・

},

{

},

{

 

複数のテストがJSONで構成されているだけなので、上記の id と name が含まれるブロック(”{”から”}”まで)をコピーして、id, name を変更してコピペすると取り込む事ができます。

id と name は、多分ユニークであれば良いのかなぁと… (未確認)

CreateSheetGID 関数を選択して実行

updateSheetName はシート名を先頭の2シート以降をシーケンシャルに設定

function CreateSheetGID() {
  var spreadsheet = SpreadsheetApp.getActive();

  var sheet = SpreadsheetApp.getActive().getSheetByName('GID');
  if(sheet == null) {
    spreadsheet.insertSheet('GID', 0);
  }
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('GID'), true);

  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  for (var i = 0 ; i < sheets.length ; i++) {
    Logger.log("\t" + sheets[i].getName() + "\t" + sheets[i].getIndex() + "\t" + sheets[i].getSheetId());

    spreadsheet.getRange('A'+ (i + 1).toString()).activate();
    spreadsheet.getCurrentCell().setValue(sheets[i].getName());

    spreadsheet.getRange('B'+ (i + 1).toString()).activate();
    spreadsheet.getCurrentCell().setValue(sheets[i].getSheetId());
  }

  Logger.log("OK");
}

function updateSheetName() {
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  
  for (var i = 2 ; i < sheets.length ; i++) {
    Logger.log("\t" + sheets[i].getName() + "\t" + sheets[i].getIndex() + "\t" + sheets[i].getSheetId());

    sheets[i].activate().activate().setName("シート"+ (i -1));
  }

}

 

The app references non-public selectors in Payload/*.app/Frameworks/UnityFramework.framework/UnityFramework: applicationWillFinishLaunchingWithOptions:, didReceiveRemoteNotification:

App ストアにアップすると謎エラー

 

ググると、Xcode のバグではないかと…

対処方法は、メソッド名を変更

didReceiveRemoteNotification -> didReceiveRemoteNotificationToUnity

applicationWillFinishLaunchingWithOptions も applicationWillFinishLaunchingWithOptionsToUnity に名前変更

 

Unity ver2020.3.38f1

xcode ver14.0.1

mac ver 12.6

 

一旦、エラーが消えてUP出来ていたが再度、謎エラー

The app references non-public selectors in Payload/*.app/Frameworks/UnityFramework.framework/UnityFramework: loadPlugink

最終的に、 xcode ver13.4.1  にDowngradeして無事アップ成功

Quickstart for Google Cardboard for Unity

https://developers.google.com/cardboard/develop/unity/quickstart

Unity ver.2020.3.38

Mac ver.12.6

Xcode ver.14.0.1

Google Cardboard のデモを iOS 用にビルドしたら以下のエラー

Showing Recent Messages
Undefined symbol: google::protobuf::MessageLite::ParseFromArray(void const*, int)
Undefined symbol: google::protobuf::RepeatedField<float>::InternalSwap(google::protobuf::RepeatedField<float>*)
Undefined symbol: google::protobuf::RepeatedField<float>::Add(float const&)
Undefined symbol: google::protobuf::RepeatedField<float>::Clear()
Undefined symbol: google::protobuf::RepeatedField<float>::MergeFrom(google::protobuf::RepeatedField<float> const&)
Undefined symbol: google::protobuf::RepeatedField<float>::RepeatedField(google::protobuf::Arena*)
Undefined symbol: google::protobuf::RepeatedField<float>::RepeatedField(google::protobuf::RepeatedField<float> const&)
Undefined symbol: google::protobuf::RepeatedField<float>::~RepeatedField()
Undefined symbol: google::protobuf::stringpiece_internal::StringPiece::LogFatalSizeTooBig(unsigned long, char const*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::WriteRawFallback(void const*, int, unsigned char*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback(unsigned char*)
Undefined symbol: google::protobuf::io::EpsCopyOutputStream::WriteStringMaybeAliasedOutline(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned char*)
Undefined symbol: google::protobuf::Arena::AllocateAlignedWithHook(unsigned long, std::type_info const*)
Undefined symbol: google::protobuf::Arena::AllocateAlignedWithCleanup(unsigned long, std::type_info const*)
Undefined symbol: google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)
Undefined symbol: google::protobuf::internal::LogMessage::~LogMessage()
Undefined symbol: google::protobuf::internal::LogMessage::operator<<(char const*)
Undefined symbol: google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)
Undefined symbol: google::protobuf::internal::WriteVarint(unsigned int, unsigned long long, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)
Undefined symbol: google::protobuf::internal::ArenaStringPtr::DestroyNoArenaSlowPath()
Undefined symbol: google::protobuf::internal::ArenaStringPtr::Set(google::protobuf::internal::ArenaStringPtr::EmptyDefault, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::Arena*)
Undefined symbol: google::protobuf::internal::ArenaStringPtr::Mutable(google::protobuf::internal::ArenaStringPtr::EmptyDefault, google::protobuf::Arena*)
Undefined symbol: google::protobuf::internal::LookUpEnumName(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, int)
Undefined symbol: google::protobuf::internal::LookUpEnumValue(google::protobuf::internal::EnumEntry const*, unsigned long, google::protobuf::stringpiece_internal::StringPiece, int*)
Undefined symbol: google::protobuf::internal::ReadTagFallback(char const*, unsigned int)
Undefined symbol: google::protobuf::internal::ThreadSafeArena::~ThreadSafeArena()
Undefined symbol: void google::protobuf::internal::InternalMetadata::DoMergeFrom<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Undefined symbol: void google::protobuf::internal::InternalMetadata::DoClear<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >()
Undefined symbol: google::protobuf::internal::PackedFloatParser(void*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::UnknownFieldParse(unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::VarintParseSlow64(char const*, unsigned int)
Undefined symbol: google::protobuf::internal::EpsCopyInputStream::DoneFallback(int, int)
Undefined symbol: google::protobuf::internal::InitializeEnumStrings(google::protobuf::internal::EnumEntry const*, int const*, unsigned long, google::protobuf::internal::ExplicitlyConstructed<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >*)
Undefined symbol: google::protobuf::internal::InitProtobufDefaultsSlow()
Undefined symbol: google::protobuf::internal::InlineGreedyStringParser(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*, google::protobuf::internal::ParseContext*)
Undefined symbol: google::protobuf::internal::fixed_address_empty_string
Undefined symbol: google::protobuf::internal::init_protobuf_defaults_state
Undefined symbol: google::protobuf::MessageLite::InitializationErrorString() const
Undefined symbol: google::protobuf::RepeatedField<float>::Get(int) const
Undefined symbol: google::protobuf::RepeatedField<float>::data() const
Undefined symbol: google::protobuf::RepeatedField<float>::size() const
Undefined symbol: typeinfo for google::protobuf::MessageLite
Undefined symbol: vtable for google::protobuf::MessageLite

google::protobuf が見つからない

対応としては、iOS 用のビルドフォルダに移動

pod init
pod install

podfile を以下に変更

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'Unity-iPhone' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Unity-iPhone

  target 'Unity-iPhone Tests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'UnityFramework' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  # add
  pod 'Protobuf-C++', '3.18.0'

  # Pods for UnityFramework

end

# add
post_install do |installer|
  installer.pods_project.targets.each do |target|
    # print "target=", target, "\n"
    if target.name == "Protobuf-C++"
      target.build_configurations.each do |config|
        config.build_settings['HEADER_SEARCH_PATHS'] = '$(SRCROOT)/Protobuf-C++/src'
      end
    end
  end
end

xcworkspace が作成されるので以下のコマンドで open

pod update
open Unity-iPhone.xcworkspace

あとは、署名してビルド

 

https://developers.google.com/cardboard/develop/unity/quickstart

 

Unity ver.2020.3.38

Mac ver.12.6

Android Sdk ver.30

 

Google Cardboard  のデモをAndroid 用にビルドしたら以下のエラー

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:3:5-94: AAPT: error: resource android:color/system_neutral1_1000 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:4:5-94: AAPT: error: resource android:color/system_neutral1_900 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:5:5-93: AAPT: error: resource android:color/system_neutral1_0 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:6:5-94: AAPT: error: resource android:color/system_neutral1_800 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:7:5-94: AAPT: error: resource android:color/system_neutral1_700 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:8:5-94: AAPT: error: resource android:color/system_neutral1_600 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:9:5-94: AAPT: error: resource android:color/system_neutral1_500 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:10:5-94: AAPT: error: resource android:color/system_neutral1_400 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:11:5-94: AAPT: error: resource android:color/system_neutral1_300 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:12:5-94: AAPT: error: resource android:color/system_neutral1_200 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:13:5-94: AAPT: error: resource android:color/system_neutral1_100 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:14:5-93: AAPT: error: resource android:color/system_neutral1_50 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:15:5-93: AAPT: error: resource android:color/system_neutral1_10 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:16:5-102: AAPT: error: resource android:color/system_neutral2_1000 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:17:5-102: AAPT: error: resource android:color/system_neutral2_900 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:18:5-101: AAPT: error: resource android:color/system_neutral2_0 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:19:5-102: AAPT: error: resource android:color/system_neutral2_800 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:20:5-102: AAPT: error: resource android:color/system_neutral2_700 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:21:5-102: AAPT: error: resource android:color/system_neutral2_600 not found.

/Users/falco/.gradle/caches/transforms-2/files-2.1/a0ebba694f8e6a95bc427eaef4894530/material-1.6.1/res/values-v31/values-v31.xml:22:5-102: AAPT: error: resource android:color/system_neutral2_500 not found.

リソースが見つからない…

 

対応としては、ライブラリーをダウングレード

// implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
// implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.protobuf:protobuf-javalite:3.19.4'

implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'

これでビルド出来た。

ConstraintLayout の基本的な考え方

<android.support.design.button.MaterialButton
    android:id="@+id/button1"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="1"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toTopOf="@id/button2" 
/>

layout_constraintBottom_toTopOf=”@id/button2″ は

@+id/button1 の constraintBottom を @id/button2 の toTop に合わせる

 

Unity で Android エミュレータを使用するとき、Android studio を起動するのが、ちょっとじゃまなので、コマンドラインからエミュレータを起動

% jdk 1.8
/usr/libexec/java_home -v1.8
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (Temurin)(build 25.302-b08, mixed mode)
// alias setting
% alias emulator="$ANDROID_HOME/emulator/emulator"
// name list show
% emulator -list-avds
Pixel_4_XL_API_21
Pixel_4_XL_API_23
Pixel_4_XL_API_25
Pixel_4_XL_API_27
Pixel_5_API_32
Pixel_5_API_33
// execute emulator @name
% emulator @Pixel_4_XL_API_23

 

Android のフレームワークの処理を確認したい時に必要な環境

  • Android エミューレータ
  • Source for Android
  • Google Apis * System image [Google play * System image ではない]

上記の環境を Android SDK よりダウンロードして、エミュレーターを起動

Android Studio の [Attach Debugger to Android Process] をクリック

[Show all processes] をチェック

[Create New] を選択、[system_process] を選択して [OK] をクリック

後は、普通のデバックと同様に、フレームワークのソースを参照出来るしブレイクポイントを設定出来ます。

※重要なのは「Google Apis * System image」を使用する事です。

Google play * System image を使用すると、[Show all processes]  チェックしても[system_process] は表示されません。

 

java.lang.IllegalStateException: Pre-packaged database has an invalid schema: WORDS(mobile.falco.EnglishTrainer.db.model.Words).
 Expected:
TableInfo{name='WORDS', columns={average=Column{name='average', type='INTEGER', affinity='3', notNull=notNull, primaryKeyPosition=0, defaultValue='0'}, ngCount=Column{name='ngCount', type='INTEGER', affinity='3', notNull=notNull, primaryKeyPosition=0, defaultValue='0'}, japanese=Column{name='japanese', type='TEXT', affinity='2', notNull=notNull, primaryKeyPosition=0, defaultValue='null'}, english=Column{name='english', type='TEXT', affinity='2', notNull=notNull, primaryKeyPosition=0, defaultValue='null'}, kigou=Column{name='kigou', type='TEXT', affinity='2', notNull=notNull, primaryKeyPosition=0, defaultValue='null'}, id=Column{name='id', type='INTEGER', affinity='3', notNull=notNull, primaryKeyPosition=1, defaultValue='null'}, ipa=Column{name='ipa', type='TEXT', affinity='2', notNull=notNull, primaryKeyPosition=0, defaultValue='null'}, okCount=Column{name='okCount', type='INTEGER', affinity='3', notNull=notNull, primaryKeyPosition=0, defaultValue='0'}}, foreignKeys=[], indices=[]}
 Found:
TableInfo{name='WORDS', columns={}, foreignKeys=[], indices=[]}
    at androidx.room.RoomOpenHelper.checkIdentity(RoomOpenHelper.kt:159)
    at androidx.room.RoomOpenHelper.onOpen(RoomOpenHelper.kt:128)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.java:326)
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:432)
    at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:321)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableOrReadableDatabase(FrameworkSQLiteOpenHelper.java:273)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.innerGetDatabase(FrameworkSQLiteOpenHelper.java:225)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getSupportDatabase(FrameworkSQLiteOpenHelper.java:183)
    at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:133)
    at androidx.room.SQLiteCopyOpenHelper.getWritableDatabase(SQLiteCopyOpenHelper.kt:71)
    at androidx.room.RoomDatabase.inTransaction(RoomDatabase.kt:634)
    at androidx.room.RoomDatabase.assertNotSuspendingTransaction(RoomDatabase.kt:430)

Android11 で実行すると上記のエラーとなる。

Android6 では問題なし。

database = Room.databaseBuilder(applicationContext, AppDatabase::class.java, "hatuon_.db")
    // .fallbackToDestructiveMigration()
    .createFromAsset("database/hatuon.db")
    .allowMainThreadQueries()
    .setJournalMode(RoomDatabase.JournalMode.TRUNCATE)
    .build()

database の名称を huton.db -> hatuon_.db にすることで正常に起動

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha