Open sandeepsmartest opened 4 years ago
Can you please explain how do i change the code inside CwebViewPlugin.java and generate jar file?Im using Mac.
My install.sh after modification(unity path)
#!/bin/sh
# required command
JAR_CMD=`which jar`
# directories
CWD=`dirname $0`
CWD=`cd $CWD && pwd -P`
BUILD_DIR="${CWD}/gradle_build"
LIBS_DIR="${BUILD_DIR}/libs"
JAVA_DIR="${BUILD_DIR}/src/main/java"
BIN_DIR="${CWD}/bin"
# options
MODE="Release"
SCRIPTING_BACKEND="il2cpp"
UNITY="/Applications/Unity/Hub/Editor/2019.3.0f3"
for OPT in $*; do
case $OPT in
'--release' )
MODE="Release";;
'--develop' )
MODE="Develop";;
'--il2cpp' )
SCRIPTING_BACKEND="il2cpp";;
'--mono' )
SCRIPTING_BACKEND="mono";;
'--unity' )
UNITY=$2
shift 2
;;
esac
shift
done
UNITY_JAVA_LIB="${UNITY}/PlaybackEngines/AndroidPlayer/Variations/${SCRIPTING_BACKEND}/${MODE}/Classes/classes.jar"
# clean
rm -rf ${JAVA_DIR}/*
rm -rf ${LIB_DIR}
rm -f ${BUILD_DIR}/src/main/AndroidManifest.xml
pushd $CWD
# copy unity library
DEST_DIR='../../build/Packager/Assets/Plugins/Android'
mkdir -p ${LIBS_DIR}
mkdir -p ${BIN_DIR}
mkdir -p ${DEST_DIR}
mkdir -p ${JAVA_DIR}
cp ${UNITY_JAVA_LIB} ${LIBS_DIR}
cp -r src/net ${JAVA_DIR}
cp AndroidManifest.xml ${BUILD_DIR}/src/main
# build
./gradlew assembleRelease
if [ ${JAR_CMD} = "" ];then
echo "jar command does not exist"
else
jar cvf ${CWD}/bin/WebViewPlugin.jar -C ${BUILD_DIR}/build/intermediates/classes/release net
cp -a ${BIN_DIR}/WebViewPlugin.jar ${DEST_DIR}
fi
./gradlew clean
popd # $BUILD_DIR
And my install.bat file
@echo off
rd /s /q bin
rd /s /q gradle_build\libs
rd /s /q gradle_build\src
mkdir bin
mkdir gradle_build\libs
mkdir gradle_build\src
mkdir gradle_build\src\main
mkdir gradle_build\src\main\java
copy /b "/Applications/Unity/Hub/Editor/2019.3.0f3/PlaybackEngines/AndroidPlayer/Variations/mono/Release/Classes/classes.jar" gradle_build\libs >nul
xcopy /s /e src gradle_build\src\main\java >nul
copy /b AndroidManifest.xml gradle_build\src\main >nul
call gradlew.bat assembleRelease
jar cf bin\WebViewPlugin.jar -C gradle_build\build\intermediates\classes\release net
My unity path
/Applications/Unity/Hub/Editor/2019.3.0f3
And this is my unity root structure(image) Please help.
The steps to build WebView.jar can be found below:
Please note that you need to install Unity 5.6.1f1 regardless of which Unity version you actually use for your app. Unity 5.6.1f1 can be retrieved from https://unity3d.com/get-unity/download/archive .
I made some changes, basically i just added a log as shown below
I was unable to create jar file. Please check the below log while im trying to execute "install.sh"
Please point me in the right direction. Thank you