Brownie doesn't import the downloaded files - solidity

I have checked various questions regarding Brownie compile. But mine is a little unique. I have some Japanese font which is not read properly by the Brownie compiler.
enter image description here
PS C:\Bharath\src\crypto\python\demos\boss\brow2\brownie_fund_me> brownie compile
INFO: Could not find files for the given pattern(s).
Brownie v1.17.2 - Python development framework for Ethereum
865kiB [00:01, 509kiB/s]
WARNING: Unable to compile smartcontractkit/chainlink-brownie-contracts#1.1.1 due to a UnicodeDecodeError - you may still be able to import sources from the package, but will be unable to load the package directly.
Compiling contracts...
Solc version: 0.6.12
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
contracts/FundMe.sol:5:1: ParserError: Source "C:/Users/チEôェバラト!EharathTV��.brownie/packages/smartcontractkit/chainlink-brownie-contracts#1.1.1/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories.
import "#chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
^--------------------------------------------------------------------------^
contracts/FundMe.sol:6:1: ParserError: Source "C:/Users/チEôェバラト!EharathTV��.brownie/packages/smartcontractkit/chainlink-brownie-contracts#1.1.1/contracts/src/v0.6/vendor/SafeMathChainlink.sol" not found: File outside of allowed directories.
import "#chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
^------------------------------------------------------------------^
contracts/test/MockV3Aggregator.sol:4:1: ParserError: Source "C:/Users/チEôェバラト!EharathTV��.brownie/packages/smartcontractkit/chainlink-brownie-contracts#1.1.1/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol" not found: File outside of allowed directories.
import "#chainlink/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol";

Did you add them into your brownie-config.yaml?
It should look like this:
dependencies:
- OpenZeppelin/openzeppelin-contracts#4.4.1
- smartcontractkit/chainlink-brownie-contracts#1.1.1
compiler:
solc:
remappings:
- '#openzeppelin=OpenZeppelin/openzeppelin-contracts#4.4.1'
- '#chainlink=smartcontractkit/chainlink-brownie contracts#1.1.1'
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY}

I was facing the same issue then i changed solidity version in FundMe.sol file
to pragma solidity ^0.6.6;
I hope this will help you as well.

There could be a possibility of typo in brownie-config.yml file. I had the same issue and I found that it was due to a misspelling.
dependencies:
# the pattern is <organization/repo>#<version>
- smartcontractkit/chainlink-brownie-contracts#1.1.1
compiler:
solc:
remappings:
- '#chainlink=smartcontractkit/chainlink-brownie-contracts#1.1.1'

Related

common:linkPodReleaseFrameworkIos e: Compilation failed: Assertion failed

I have a problem with archiving(realising my app).
I'm using the following dependency versions:
kotlin=1.6.10
ktor=2.0.0-beta-1
kotlinx.datetime=0.2.1
kotlinx.serialization=1.3.2
Tried to change versions of Kotlin serialisation plugin, or date time plugin but it hasn't fixed the issue. Any ideas where is the problem?
I'm receiving error:
Task :common:linkPodReleaseFrameworkIos
e: Compilation failed: Assertion failed
* Source files:
* Compiler version info: Konan: 1.6.0 / Kotlin: 1.6.0
* Output kind: FRAMEWORK
e: java.lang.AssertionError: Assertion failed
at org.jetbrains.kotlin.backend.konan.objcexport.MethodBridgeKt.parametersAssociated(MethodBridge.kt:120)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.generateKotlinToObjCBridge(ObjCExportCodeGenerator.kt:1029)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.createReverseAdapter(ObjCExportCodeGenerator.kt:1180)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.createReverseAdapters(ObjCExportCodeGenerator.kt:1463)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.createReverseAdapters$getOrCreateFor(ObjCExportCodeGenerator.kt:1404)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.createReverseAdapters(ObjCExportCodeGenerator.kt:1407)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGeneratorKt.access$createReverseAdapters(ObjCExportCodeGenerator.kt:1)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGenerator.generateTypeAdaptersForKotlinTypes(ObjCExportCodeGenerator.kt:262)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGenerator.generateTypeAdapters(ObjCExportCodeGenerator.kt:289)
at org.jetbrains.kotlin.backend.konan.llvm.objcexport.ObjCExportCodeGenerator.generate$backend_native_compiler(ObjCExportCodeGenerator.kt:300)
at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport.generate$backend_native_compiler(ObjCExport.kt:103)
at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor$visitModuleFragment$2.invoke(IrToBitcode.kt:433)
at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor$visitModuleFragment$2.invoke(IrToBitcode.kt:431)
at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.runAndProcessInitializers(IrToBitcode.kt:370)
at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:431)
at org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid$DefaultImpls.visitModuleFragment(IrElementVisitorVoid.kt:28)
at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:204)
at org.jetbrains.kotlin.backend.konan.llvm.CodeGeneratorVisitor.visitModuleFragment(IrToBitcode.kt:204)
This is a bug, already described at https://youtrack.jetbrains.com/issue/KT-49395.
From what I see in this ticket, the problem should be already fixed in Kotlin 1.6.20-M1.If you can use preview versions in your project, consider trying it as described here: https://blog.jetbrains.com/kotlin/2022/02/kotlin-1-6-20-m1-released/.

Adding sub module to project causing gradle build failures in Android studio 3.0 with gradle version 4.1

I added sub module library vertical-stepper-form version 0.9.8, while I set dependency of this library on my app module. I was able to do it successfully.
I am using Android Studio 3.0 with gradle version 4.1, few of the classes in project are in kotlin and others in java
When I started gradle sync it gave me this error. The gradle is not building and showing below issues :
/*********************************/
Information:Gradle tasks [:vertical-stepper-form:generateDebugSources,
:vertical-stepper-form:generateDebugAndroidTestSources,
:vertical-stepper-form:mockableAndroidJar,
:app:generateInstallDebugSources,
:app:generateInstallDebugAndroidTestSources, :app:mockableAndroidJar]
D:\Devavrata\project/package/src/main/res/abc.xml Error:error:
attribute 'com.spireon.install:src' not found.
D:\Devavrata\AbcProject\abc-Android\app\build\intermediates\incremental\mergeInstallDebugResources\stripped.dir\layout\activity_main.xml
Error:attribute 'com.spireon.install:src' not found. Error:failed
linking file resources. Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error:
check logs for details Error:Execution failed for task
':app:processInstallDebugResources'.
Failed to execute aapt Information:BUILD FAILED in 24s Information:7 errors Information:0 warnings Information:See complete output in
console
/********************************/
What I have already tried :
I tried with changing import lines in xml also changing the android:src and srcCompat properties. Along with build/project cleaning and invalidating the cache.
Changing this line in gradle.properties
android.enableAapt2=false
Let me know if anyone has faced this issue

VSTS build failing with error "Process 'msbuild.exe' exited with code '1'."

Getting that build failed error because I have 4 warnings that read the same.
##[warning]C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python Tools\Microsoft.PythonTools.Django.targets(120,5): Warning : Errors while resolving environments: Some project interpreters failed to load:
Interpreter d:\a\1\s\"name of project"\env\ has invalid value for 'Id': env
Interpreter reference has invalid path: Global|PythonCore|3.4
I am using Python 3.4.4 64-bit if that makes a difference.
The build is failing during the Build solution **\*.sln section of the build.
Thank you in advance for any help.
Edit pyproj file to change 10.0 to 15.0
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>

Build Linux Kernel module with warning i2c_register_board_info undefined

I follow an example in kernel.org to write an i2c driver but unfortunately when i compile i got this warning
WARNING: "i2c_register_board_info" [/home/pi/builddriver/samplei2c/pn535.ko] undefined!
Although compile with 1 warning and no error, I cannot insmod module. this is error when insmod
insmod: ERROR: could not insert module pn535.ko: Invalid module format
My question is how to solve the warning above?, I think it make .ko file to be invalid. Here is my source code on
pastebin
thank for your help!
That is not possible in a kernel module simply because the function i2c_register_board_info is not exported from the kernel source tree to the kernel modules (built using obj-m targets). You can achieve this by building your driver within the kernel source tree using (obj-y targets).

ResourceNotFoundException error when accessing image in Android Titanium module

I'm developing an Android Module for a Titanium app and I have to generate a Notification. Android SDK forces me to do a setSmallIcon() call to include a png asset as icon for the notification. I've put icon_notification.png asset in /platform/android/res/drawable folder of my module and (tryed to) got it in the code calling
TiRHelper.getResource("drawable.icon_notification")
but when I build module calling ant, the following error is raised:
[javac] Note: [KrollBindingGen] Running Kroll binding generator.
[javac] Note: [KrollBindingGen] No binding data found, creating new data file: org.appcelerator.titanium.bindings/connecthings.json
[javac] Note: [KrollBindingGen] Found binding for proxy Beacon
[javac] Note: [KrollBindingGen] Found binding for module Connect
[javac] Note: [KrollBindingGen] Generating JSON: file:/Users/***/Development/***/modules/android/***/android/build/generated/json/org/appcelerator/titanium/bindings/***.json
[javac] warning: The following options were not recognized by any processor: '[kroll.checkTiContext]'
[javac] /Users/***/Development/***/modules/android/***/android/src/***/***/***/***/ConnectModule.java:76: error: unreported exception ResourceNotFoundException; must be caught or declared to be thrown
[javac] .setSmallIcon(TiRHelper.getResource("drawable.icon_notification"))
[javac] ^
[javac] Note: /Users/***/Development/***/modules/android/***/android/src/***/***/ti/***/BeaconProxy.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
seems that raising a ResourceNotFoundException exception, builder doesn't find the assset
Have I placed the file in the wrong place?
The platform folder also has to sub-folder of android folder.The full directory is "android/platform/android/res/drawable/". You can also check if the resources are created in the build folder.
Documentation Link
Error posted is trowed during build step of the module.
In this step I think that resources are not already put in place, so, wrapping the TiRHelper method in a try...catch statement as written in the wiki suggested by #Saeed Sharman resolve the problem.
So, the working version is simply:
try {
TiRHelper.getResource("drawable.icon_notification");
catch (ResourceNotFoundException e) {
...
}