|
|
@@ -2,6 +2,11 @@ package com.example.smartbowlib;
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.nio.channels.FileChannel;
|
|
|
+
|
|
|
import static org.junit.Assert.*;
|
|
|
|
|
|
/**
|
|
|
@@ -14,4 +19,27 @@ public class ExampleUnitTest {
|
|
|
public void addition_isCorrect() {
|
|
|
assertEquals(4, 2 + 2);
|
|
|
}
|
|
|
+ @Test
|
|
|
+ public void copyToDest() { //把导出的arr包复制到目标目录
|
|
|
+ String fileName = "smartbowlib-debug.aar";
|
|
|
+ File source = new File("E:\\UnityProject\\SmartBow\\SmartBowLib\\smartbowlib\\build\\outputs\\aar\\" + fileName);
|
|
|
+ File dest = new File("E:\\UnityProject\\SmartBow\\Assets\\Plugins\\Android\\" + fileName);
|
|
|
+ FileChannel inputChannel = null;
|
|
|
+ FileChannel outputChannel = null;
|
|
|
+ try {
|
|
|
+ inputChannel = new FileInputStream(source).getChannel();
|
|
|
+ outputChannel = new FileOutputStream(dest).getChannel();
|
|
|
+ outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ inputChannel.close();
|
|
|
+ outputChannel.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("复制成功");
|
|
|
+ }
|
|
|
}
|