Cannot find src/main/jni from the Android Studio project - android

In order to use NDK in my application, I included an external tool at Preferences -> Tools -> External Tools.
Here's what I did.
As I right-clicked a class and chose the external javah command to create a c class, it didn't work and left a following message.
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: /src/main/jni
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:129)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:107)
at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:64)
at com.sun.tools.javah.JavahTask.run(JavahTask.java:503)
at com.sun.tools.javah.JavahTask.run(JavahTask.java:329)
at com.sun.tools.javah.Main.main(Main.java:46)
Process finished with exit code 1
I properly created the jni folder under the main directory, and I'm still not clear why I keep getting this message.
Here's my development environment.
OS: OS X El Capitan
Android Studio: 2.2.2

I solved this problem by modifying the Parameters and Working Directory as follows.
Parameters: -classpath $Classpath$ -v -jni $FileClass$
Working Directory: $ProjectFileDir$/app/src/main/jni

Related

Can we debug the APK with ASAN active on Android Studio?

My project is a simple game with native C++ code and Java, which uses cmake to compile C/C++ code. I'm using address sanitizer to check my the code. I follow the instruction here
My OS is windows 10 64bit.
However, when I press debug on Android Studio, I got the message as
2020-03-19 13:50:56.946 5152-5152/? E/logwrapper: executing /data/app/com.indie.haiphan.Breakout-ZFFz_f8ETleajrgP6rg9gw==/lib/arm64/wrap.sh failed: No such file or directory
2020-03-19 13:50:56.946 5151-5151/? I/wrap.sh: executing /data/app/com.indie.haiphan.Breakout-ZFFz_f8ETleajrgP6rg9gw==/lib/arm64/wrap.sh failed: No such file or directory
2020-03-19 13:50:56.956 5151-5151/? I/wrap.sh: wrap.sh terminated by exit(255)
2020-03-19 13:50:56.957 873-873/? W/Zygote: Error reading pid from wrapped process, child may have died
I checked on my APK (with Analyze APK of Android Studio) the wrap.sh exist.
So my question is I can't debug with wrap.sh inside the APK?
Thanks
You probably have BOM or an extra carriage return at the end of the first line of your wrap.sh. Which is possible in windows.
To fix it you can use dos2unix tool.
See this: https://unix.stackexchange.com/a/27067/197738

stuck on creating 'moor_database.g.dart'

I wanted to generate file 'moor_database.g.dart' by typing the command 'flutter packages pub run build_runner watch' but after doing some procedures it just tells: [INFO] Succeeded after 9.0s with 0 outputs (4 actions)
And inside the terminal results I saw this warning:
[WARNING] moor_generator:moor_generator on lib/data/moor.dart: Missing "part 'moor.g.dart';".
I had this message because I had my own file called moor.dart which conflicted with the moor library file (that's why that command was not working properly) but Android Studio didn't give any direct errors or warning on that, after renaming my file name, everything worked

Unable to launch WebDriver Agent because of xcodebuild failure

Me using Xcode_8.2.1 . When i am building my app its trowing error implicit converstation from nullable pointer
I suggest to
Get clean WebDriverAgent project from github repo or via appium installation, you can find it on your local machine:
/Users/someName/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
Run ./Scripts/bootstrap.sh for "clean" project in path specified above
Open WebDriverAgent.xcodeproj and check if there are any errors

Xamarin MultiDex in VisualStudio 2015

Hi everybody I'm in a dead end!
Develop a PCL application using VisualStudio 2015, Xamarin and MvvmCross.
The Android app exceeds the 65K limit. I need to use Multidex!
For its implementation I have undertaken these guidelines:
Enabled checkbox for MultiDex
Extended MultiDexApplication class
General considerations:
Debug mode
MinSdk: 21
TargetSdk: 25
BuildTools: 23.0.3
Jdk 1.8.0_121
Xamarin.Android 7.3
Results:
"java.exe" exited with code 2. C:\Program Files (x86)\MSBuild\Xamarin \Android\Xamarin.Android.Common.targets 1965
<!-- Compile java code to dalvik -->
<CompileToDalvik
DxJarPath="$(DxJarPath)"
JavaToolPath="$(JavaToolPath)"
JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
JavaOptions="$(JavaOptions)"
ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
ToolPath="$(DxToolPath)"
ToolExe="$(DxToolExe)"
UseDx="$(UseDx)"
MultiDexEnabled="$(AndroidEnableMultiDex)"
MultiDexMainDexListFile="$(_AndroidMainDexListFile)"
JavaLibrariesToCompile="#(_JavaLibrariesToCompileForAppDx)"
OptionalObfuscatedJarFile="$(IntermediateOutputPath)proguard\__proguard_output__.jar"
/>
The error occurs during the compilation process.
I have consulted these sources:
"https://developer.android.com/studio/build/multidex.html"
"http://www.jon-douglas.com/2016/09/05/xamarin-android-multidex/"
"http://www.jon-douglas.com/2016/09/23/xamarin-android-multidex-keep/"
"https://przemekraciborski.eu/"
"https://forums.xamarin.com/discussion/64234/multi-dex-app-with-a-custom-application-class-that-runs-on-pre-lollipop"
"http://frogermcs.github.io/MultiDex-solution-for-64k-limit-in-Dalvik/"
I also have the ClassyShark.jar tool, but no dex or apk file is generated to explore it. Only the mono.android.jar file exists
Please I need help.
Thank you very much.
Responding to answer 1 and Luke Pothier's commentary are the results:
Setting output verbosity = Diagnostic
Case 1:
Using Android Sdk Location: C:\Program Files (x86)\Android\android-sdk installed with Visual Studio 2015.
4>_CompileToDalvikWithDx:
4> Creating directory "obj\Debug\proguard".
4> C:\Program Files\Java\jdk1.8.0_121\\bin\java.exe -Xmx1G -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\\lib\dx.jar" --no-strict --dex --output= ...
4> trouble writing output: Too many field references: 68102; max is 65536.
4> You may try using --multi-dex option.
4> References by package:
(list of references by packages)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1965,3): error MSB6006: "java.exe" exited with code 2.
Case 2:
Using Android Sdk Location: c:\android\sdk with last proguard version 5.3.3 installed with Android Studio.
4>_CompileToDalvikWithDx:
4> Creating directory "obj\Debug\proguard".
4> C:\Program Files\Java\jdk1.8.0_121\\bin\java.exe -Xmx1G -jar C:\Android\sdk\build-tools\25.0.0\\lib\dx.jar --no-strict --dex --output=
4> trouble writing output: Too many field references: 68102; max is 65536.
4> You may try using --multi-dex option.
4> References by package:
(list of references by packages)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1965,3): error MSB6006: "java.exe" exited with code 2.
This is likely to be caused by an issue between Xamarin and ProGuard, the fix to which is detailed here. Essentially, you need to replace the proguard.jar file that is in your Android SDK directory with the latest one from SourceForge (v5.3.3 currently).
EDIT: Per the error messages in your edits, the --multi-dex option isn't being passed during compilation. I would check your Android .csproj to make sure that the <AndroidEnableMultiDex> option is set to True for all build configurations. If that doesn't help, you may need to upload a reproducible sample somewhere.
EDIT 2: Per the comments, your Android SDK location needs to be somewhere where the path does not contain spaces. Program Files is no good. Personally I put mine in C:\Android\android-sdk.
After adjusting the path to the android sdk, removing the spaces and setting in the project file for the Droid platform the property AndroidEnableMultiDex in all configurations (appeared AndroidEnableMultipleDex) in true, I was able to compile without errors. Also, I have been able to check the contents of the generated dex files and both have references to Mvvmcross.
When I execute the application, it shows the splash view (ok!!!), but, an exception occurs when processing the view (activity) that has a binded viewmodel. Now, the viewmodel has null value. (Until the moment of having to activate the multidex, the application executed without any incidence)
My challenge now is to know if all the reference to Mvvmcross should be in the main dex, or is it due to another problem that I have overlooked?
Thanks in advance for his time to #LukePothier.
My self response:
After compiling and generate dex classes:
use dex2jar & jd-gui tools following Jon Douglas' hints in http://www.jon-douglas.com/2016/09/23/xamarin-android-multidex-keep/.
be very patient and persevere.
remove innesesary code and plugin if you can do it yourself.
I already have the application running !!!

./create-android-project.sh: line 103: /home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk/tools/android: No such file or directory

I am trying to build project of cocos2dx in my eclipse.whenever I am try to run ./create-android-project.sh command on my terminal its gives me an error saying :-
Now cocos2d-x supports Android 2.2 or upper version
./create-android-project.sh: line 103: /home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk/tools/android: No such file or directory
input target id:
I have made every change as per suggested in this tutorial :- http://www.raywenderlich.com/33750/cocos2d-x-tutorial-for-ios-and-android-getting-started
I have changed the following lines :-
# set environment paramters
NDK_ROOT_LOCAL="/home/laschweinski/android/android-ndk-r8d"
ANDROID_SDK_ROOT_LOCAL="/home/laschweinski/android/android-sdk-linux_86"
to
NDK_ROOT_LOCAL="/home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/android-ndk-r10d"
ANDROID_SDK_ROOT_LOCAL="/home/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/sdk"
in create-android-project.sh shell script.
have also provided path of my NDK in build_native.sh.
Can anyone tell me that where I am lacking in building this project. Any help will be appreciated. I am working on Ubuntu.
Thanks.

Categories

Resources