Android studio OLD

## Android Studio ### 开始阶段 [使用AndroidStudio调试SDK包步骤](https://www.tapd.cn/21767111/documents/show/1121767111001000140?file_type=word-local&file_ext=docx) ### 打开Android Studio 弹窗(gradle)-> OK ![image.png](https://cos.easydoc.net/86351604/files/kcwmt73s.png) 和本机的Build Tools version有关,项目目前SDK版本定为26 ![image.png](https://cos.easydoc.net/86351604/files/kcwmu5le.png) [Unity使用gradle打包出现的配置TargetSDK的问题.docx](https://www.tapd.cn/21767111/documents/show/1121767111001000137?file_type=word-local&file_ext=docx) 也有相关说明 ### 其他设置 ![image.png](https://cos.easydoc.net/86351604/files/kcwmxtg5.png) ``` buildTypes { debug { jniDebuggable true signingConfig signingConfigs.release } release { // Set minifyEnabled to true if you want to run ProGuard on your project minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt' debuggable true signingConfig signingConfigs.release } } dexOptions { javaMaxHeapSize "4g" } ``` gradle统一,目前修改为2.10 详见[使用AndroidStudio调试SDK包步骤.docx](https://www.tapd.cn/21767111/documents/show/1121767111001000140?file_type=word-local&file_ext=docx) ### 报错 1、finished with non-zero exit value 1 [gradle编译异常记录:finished with non-zero exit value 1-3](https://www.jianshu.com/p/6276fbcdf8ba) 2、字节跳动demo的运行时的报错,gradle版本? ![image.png](https://cos.easydoc.net/86351604/files/kdijcsoa.png) ### 调试 ``` gradlew processDebugResources --debug ``` ### Android 延迟调用 [Android延迟执行的三种方式](https://www.jianshu.com/p/a2689e38048b) [Runnable的使用说明](https://www.jianshu.com/p/0c9a74ef87ef) ``` Thread syncLogin = new Thread() { @Override public void run() { try { sleep(1000); Log.d(LOG_TAG, "5000 " + isLogin); if (!isLogin) { login(); } } catch (InterruptedException e) { e.printStackTrace(); Log.d(LOG_TAG, " " + e.toString()); } } }; syncLogin.start(); ``` ``` LoginRunnable run1=new LoginRunnable(); //创建Thread实例并将runnable实例放入 Thread th1=new Thread(run1,"th1"); //通过线程实例控制线程的行为(运行、停止) th1.start(); class LoginRunnable implements Runnable { @Override public void run() { try { Thread.sleep(1000); if (!isLogin) { login(); } } catch (InterruptedException e) { e.printStackTrace(); } } } ```