I have successfully created a new module in app/code/CompanyName_ModuleName and created etc/module.xml and after that run following command from my terminal in my sudo php bin/magento setup:upgrade
my module is showing in config.xml file and it's value is set 1. But as soon as I hit the Url in browser I found this error/exception
exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't create directory /var/www/html/hml/var/generation/Magento/Framework/App/Response/Http/.' in /var/www/html/hml/vendor/magento/framework/Code/Generator.php:103 Stack trace: #0 /var/www/html/hml/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Framewo...') #1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Framewo...') #2 [internal function]: spl_autoload_call('Magento\Framewo...') #3 /var/www/html/hml/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Framewo...') #4 /var/www/html/hml/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Framewo...') #5 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Framewo...') #6 /var/www/html/hml/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...') #7 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): Magento\Framework\ObjectManager\ObjectManager->get('Magento\Framewo...') #8 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\Framewo...', NULL, 'response', 'Magento\Framewo...') #9 /var/www/html/hml/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\Framewo...', Array, Array) #10 /var/www/html/hml/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Framewo...', Array) #11 /var/www/html/hml/vendor/magento/framework/App/Bootstrap.php(233): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Framewo...', Array) #12 /var/www/html/hml/index.php(38): Magento\Framework\App\Bootstrap->createApplication('Magento\Framewo...') #13 {main}'
Please help me out...Thanks in advance.